From 14261a1ad14dcde940f0ef83559686e09feacfed Mon Sep 17 00:00:00 2001 From: liyj <1617420630@qq.com> Date: Fri, 19 Sep 2025 18:08:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=B6=88=E6=81=AF=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E5=9B=9E=E8=B0=83=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=8C=E9=80=9A=E8=BF=87=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=9C=8D=E5=8A=A1=E5=99=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/mobile/WeiXinController.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mall-account/src/main/java/com/suisung/mall/account/controller/mobile/WeiXinController.java b/mall-account/src/main/java/com/suisung/mall/account/controller/mobile/WeiXinController.java index e881a253..40254026 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/controller/mobile/WeiXinController.java +++ b/mall-account/src/main/java/com/suisung/mall/account/controller/mobile/WeiXinController.java @@ -7,6 +7,7 @@ import com.suisung.mall.account.service.WeiXinService; import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.service.impl.BaseControllerImpl; import com.suisung.mall.common.utils.I18nUtil; +import com.suisung.mall.common.utils.StringUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -144,16 +145,18 @@ public class WeiXinController extends BaseControllerImpl { @ApiOperation(value = "小程序回调", notes = "小程序回调") @RequestMapping(value = "/xcxCallBack", method = RequestMethod.GET) - public CommonResult xcxCallBack(@RequestParam("signature") String signature, - @RequestParam("timestamp") String timestamp, - @RequestParam("nonce") String nonce, - @RequestParam("echostr") String echostr) { + public CommonResult xcxCallBack(@RequestParam(value = "signature",required = false) String signature, + @RequestParam(value = "timestamp",required = false) String timestamp, + @RequestParam(value = "nonce",required = false) String nonce, + @RequestParam(value = "echostr",required = false) String echostr) { + if(StringUtils.isEmpty(signature) || StringUtils.isEmpty(signature) || StringUtils.isEmpty(signature) || StringUtils.isEmpty(signature) ) { + return CommonResult.success("校验成功");//todo 配置好消息链接改回来,腾讯服务器测试提交没有发送参数,导致报错 + } boolean checked=weiXinService.checkSignature(timestamp, nonce, signature); if(!checked){ return CommonResult.failed("校验失败"); } - JSONObject jsonObject= JSONUtil.parseObj(echostr); - accountUserBindConnectService.bindTmplId(jsonObject); + accountUserBindConnectService.bindTmplId(echostr); return CommonResult.success("小程序订阅消息模板绑定成功"); }