xiaoyong931011
2023-08-15 84c7afc62bb1eb6f5d80d2d9928d0d11a1ffbdda
src/main/java/cc/mrbird/febs/pay/controller/AutoReplyController.java
@@ -3,7 +3,9 @@
import cc.mrbird.febs.common.properties.XcxProperties;
import cc.mrbird.febs.common.utils.SpringContextHolder;
import cc.mrbird.febs.pay.util.WechatEventUtil;
import cc.mrbird.febs.pay.util.WeixinServiceUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -22,17 +24,11 @@
@RequestMapping(value = "/api/wechat/reply")
public class AutoReplyController {
    private final String wechatToken = "ywgpzfwh";
    private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class);
//    @Value("${wechat.appId}")
//    private String wechatAppId;
//
//    @Value("${wechat.appSecret}")
//    private String wechatAppSecret;
//
//    // 这个Token就是微信后台 服务器配置 中的Token
//    @Value("${wechat.token}")
//    private String wechatToken;
    @Autowired
    WechatEventUtil wechatEventUtil;
    /**
     * 服务器校验
@@ -41,7 +37,7 @@
     */
    @GetMapping("/event")
    public String verification(HttpServletRequest req) {
        return WechatEventUtil.verification(req, xcxProperties.getWechatToken());
        return wechatEventUtil.verification(req, wechatToken);
    }
    /**
@@ -56,7 +52,7 @@
        String message = "success";
        PrintWriter out = resp.getWriter();
        try {
            String messageEvent = WechatEventUtil.messageEvent(req);
            String messageEvent = wechatEventUtil.messageEvent(req);
            if(messageEvent != null) {
                message = messageEvent;
            }