Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GCS-ZHN committed Jan 17, 2022
1 parent 27b8025 commit 22c2a91
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.gcszhn</groupId>
<artifactId>autocard</artifactId>
<version>1.3.7</version>
<version>1.3.8</version>
<packaging>jar</packaging>

<name>Auto Heathy Report for Zhejiang University</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public ArrayList<NameValuePair> getOldInfo(String username, String password) {
case "date" : value=sdf.format(new Date());break;
case "bztcyy": value="";break; //地区变更需要手动打卡一次,过滤上一次的地区变更原因
}
if (value==null||value.equals("")||value.toString().equals("[]")) return; //空数组不上报
if (value==null||value.toString().equals("[]")) return; //空数组不上报
res.add(new BasicNameValuePair(name, String.valueOf(value)));
});
} catch (Exception e) {
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/org/gcszhn/autocard/utils/DigestUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright © 2021 <a href="mailto:[email protected]">Zhang.H.N</a>.
*
* Licensed under the Apache License, Version 2.0 (thie "License");
* You may not use this file except in compliance with the license.
* You may obtain a copy of the License at
*
* http://wwww.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language govering permissions and
* limitations under the License.
*/
package org.gcszhn.autocard.utils;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;


public class DigestUtils {
public static String digest(String message, String algorithm) throws NoSuchAlgorithmException {
byte[] data = message.getBytes(StandardCharsets.UTF_8);
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(data);
return new String(Base64.getEncoder().encode(md.digest()), StandardCharsets.UTF_8);
}
}
4 changes: 2 additions & 2 deletions src/test/java/org/gcszhn/autocard/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
@RunWith(SpringRunner.class)
@SpringBootTest
public abstract class AppTest {
protected static final String trueZjuPassPortUser = "120xxxx";
protected static final String trueZjuPassPortPass = "zjuxxxxx";
protected static final String trueZjuPassPortUser = "220****";
protected static final String trueZjuPassPortPass = "202****";
}
2 changes: 1 addition & 1 deletion src/test/java/org/gcszhn/autocard/AutoClockinTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void getPageTest() {
}
@Test
public void getOldInfoTest() {
Assert.assertNotNull(autoCard.getOldInfo(trueZjuPassPortUser, trueZjuPassPortPass));
System.out.println(autoCard.getOldInfo(trueZjuPassPortUser, trueZjuPassPortPass));
}
@Test
public void submitReportTest() {
Expand Down

0 comments on commit 22c2a91

Please sign in to comment.