记得上下班打卡 | git大法好,push需谨慎

Commit 00c8a0ee authored by jiangxiulong's avatar jiangxiulong

record 增加摩登

parent e52bfa84
...@@ -50,6 +50,7 @@ public class SweetWechatActionCallbackController { ...@@ -50,6 +50,7 @@ public class SweetWechatActionCallbackController {
@ApiOperation("用户动作微信回调") @ApiOperation("用户动作微信回调")
public String record( public String record(
@RequestBody String requestBody, @RequestBody String requestBody,
@RequestParam("type") Integer type,
@RequestParam("signature") String signature, @RequestParam("signature") String signature,
@RequestParam("timestamp") String timestamp, @RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce, @RequestParam("nonce") String nonce,
...@@ -57,13 +58,13 @@ public class SweetWechatActionCallbackController { ...@@ -57,13 +58,13 @@ public class SweetWechatActionCallbackController {
@RequestParam(name = "encrypt_type", required = false) String encType, @RequestParam(name = "encrypt_type", required = false) String encType,
@RequestParam(name = "msg_signature", required = false) String msgSignature @RequestParam(name = "msg_signature", required = false) String msgSignature
) { ) {
log.info("\n接收微信请求:[openid=[{}], [signature=[{}], encType=[{}], msgSignature=[{}]," log.info("\n接收微信请求:[type=[{}], openid=[{}], [signature=[{}], encType=[{}], msgSignature=[{}],"
+ " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ", + " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
openid, signature, encType, msgSignature, timestamp, nonce, requestBody); type, openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
if (!wechatSignUtils.checkSignature(signature, timestamp, nonce)) { if (!wechatSignUtils.checkSignature(signature, timestamp, nonce)) {
log.info("验签未通过,非法请求,可能属于伪造的请求!"); log.info("验签未通过,非法请求,可能属于伪造的请求!");
return ""; return "";
} }
return sweetWechatCallbackService.record(requestBody, timestamp, nonce, encType, msgSignature); return sweetWechatCallbackService.record(requestBody, type, timestamp, nonce, encType, msgSignature);
} }
} }
...@@ -73,7 +73,6 @@ public class SubscribeHandler implements WxMpMessageHandler { ...@@ -73,7 +73,6 @@ public class SubscribeHandler implements WxMpMessageHandler {
sweetWechatUser.setUserId(IDGenerator.nextSnowId()); sweetWechatUser.setUserId(IDGenerator.nextSnowId());
LinkedList<String> sqls = CollectionUtil.linkedListString(); LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
LocalDateTime now = LocalDateTime.now();
sqls.add(SqlMapping.get("sweet_user.insert")); sqls.add(SqlMapping.get("sweet_user.insert"));
sqlsDataA.add(new Object[]{ sqlsDataA.add(new Object[]{
sweetWechatUser.getUserId(), sweetWechatUser.getOpenId(), sweetWechatUser.getUnionId(), sweetWechatUser.getNickname(), sweetWechatUser.getUserId(), sweetWechatUser.getOpenId(), sweetWechatUser.getUnionId(), sweetWechatUser.getNickname(),
......
...@@ -53,8 +53,11 @@ public class SweetWechatCallbackServiceImpl { ...@@ -53,8 +53,11 @@ public class SweetWechatCallbackServiceImpl {
return router; return router;
} }
public String record(String requestBody, String timestamp, String nonce, String encType, String msgSignature) { public String record(String requestBody, Integer type, String timestamp, String nonce, String encType, String msgSignature) {
WxMpService wxMpService = wechatMpConfigure.getWxMpService(1); if (null == type || type <= 0) {
type = 1;
}
WxMpService wxMpService = wechatMpConfigure.getWxMpService(type);
String out = null; String out = null;
if (encType == null || encType.isEmpty()) { if (encType == null || encType.isEmpty()) {
// 明文传输的消息 // 明文传输的消息
......
...@@ -24,7 +24,7 @@ public class WechatSignUtils { ...@@ -24,7 +24,7 @@ public class WechatSignUtils {
/** /**
* 验证签名 * 验证签名
* * 验签不区分服务号 token url配置成一样
* @param signature * @param signature
* @param timestamp * @param timestamp
* @param nonce * @param nonce
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment