微信消息推送回调接口参数调整

This commit is contained in:
liyj 2025-09-19 17:37:52 +08:00
parent e100c95d3b
commit 61e1614c62

View File

@ -1,6 +1,7 @@
package com.suisung.mall.account.controller.mobile;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.suisung.mall.account.service.AccountUserBindConnectService;
import com.suisung.mall.account.service.WeiXinService;
import com.suisung.mall.common.api.CommonResult;
@ -142,15 +143,16 @@ public class WeiXinController extends BaseControllerImpl {
@ApiOperation(value = "小程序回调", notes = "小程序回调")
@RequestMapping(value = "/xcxCallBack")
public CommonResult xcxCallBack(@RequestBody JSONObject jsonObject,
@RequestParam("signature") String signature,
@RequestMapping(value = "/xcxCallBack", method = RequestMethod.GET)
public CommonResult xcxCallBack(@RequestParam("signature") String signature,
@RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce) {
@RequestParam("nonce") String nonce,
@RequestParam("echostr") String echostr) {
boolean checked=weiXinService.checkSignature(timestamp, nonce, signature);
if(!checked){
return CommonResult.failed("校验失败");
}
JSONObject jsonObject= JSONUtil.parseObj(echostr);
accountUserBindConnectService.bindTmplId(jsonObject);
return CommonResult.success("小程序订阅消息模板绑定成功");
}