微信公众号(测试号)开发

总体概述:

git链接:

<dependency>
   <groupId>com.github.binarywang</groupId>
   <artifactId>weixin-java-mp</artifactId>
   <version>3.6.0</version>
</dependency>

测试号申请网址:

测试号配置:

接口配置信息:

JS接口安全域名:

checkSignature接口实例(可查看文档,翻开该接口规则)

@RequestMapping(value = "/wx/checkSignature")
    @ResponseBody
    public String checkSignature(String signature, String timestamp, String nonce, String echostr) {
        if (StringUtils.isAnyBlank(signature, timestamp, nonce, echostr)) {
            throw new IllegalArgumentException("请求参数非法,请核实!");
        }

        if (wxService.checkSignature(timestamp, nonce, signature)) {
            return echostr;
        }

        return "非法请求";
    }

为占位符封装对象

经验分享 程序员 微信小程序 职场和发展