Skip to content

Commit 9c0e9e4

Browse files
committed
检查签名时,如果有异常打印出日志
1 parent 787a4cc commit 9c0e9e4

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/SHA1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static String genWithAmple(String... arr) {
3333
if (StringUtils.isAnyEmpty(arr)) {
3434
throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr));
3535
}
36-
36+
3737
Arrays.sort(arr);
3838
StringBuilder sb = new StringBuilder();
3939
for (int i = 0; i < arr.length; i++) {

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/AbstractWxCpServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public boolean checkSignature(String msgSignature, String timestamp, String nonc
6363
return SHA1.gen(this.configStorage.getToken(), timestamp, nonce, data)
6464
.equals(msgSignature);
6565
} catch (Exception e) {
66+
this.log.error("Checking signature failed, and the reason is :" + e.getMessage());
6667
return false;
6768
}
6869
}
@@ -293,7 +294,7 @@ public List<WxCpUser> userList(Integer departId, Boolean fetchChild, Integer sta
293294
String responseContent = get(url, params);
294295
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
295296
return WxCpGsonBuilder.INSTANCE.create()
296-
.fromJson( tmpJsonElement.getAsJsonObject().get("userlist"),
297+
.fromJson(tmpJsonElement.getAsJsonObject().get("userlist"),
297298
new TypeToken<List<WxCpUser>>() {
298299
}.getType()
299300
);

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/AbstractWxMpServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public boolean checkSignature(String timestamp, String nonce, String signature)
5353
return SHA1.gen(this.getWxMpConfigStorage().getToken(), timestamp, nonce)
5454
.equals(signature);
5555
} catch (Exception e) {
56+
this.log.error("Checking signature failed, and the reason is :" + e.getMessage());
5657
return false;
5758
}
5859
}

0 commit comments

Comments
 (0)