第三方“消息与事件接收URL”如何配置
发布于 6 年前 作者 zyao 5549 次浏览 来自 问答

第三方平台提交小程序代码审核,回执信息需请求“消息与事件接收URL”配置的接口,代码设置通过单接口未收到任何参数请求!第三方平台配置的“消息与事件接收URL

https://XXX.com/warrant/$APPID$/xxsCallback

后台推送数据接收接口:

[@Controller](/user/Controller)
[@RequestMapping](/user/RequestMapping)("/warrant")
public class WarrantController {
     
    /**
    * [@Description](/user/Description): 第三方平台全网发布,消息与事件接收URL
    * [@Author](/user/Author): Mr.Jkx
    * [@Date](/user/Date): 2019/5/8 18:10
    */
    [@RequestMapping](/user/RequestMapping)(value = "/$APPID$/xxsCallback")
    public void acceptMessageAndEvent(HttpServletRequest request, [@PathVariable](/user/PathVariable)("APPID") String appid,
                                      HttpServletResponse response) throws IOException, DocumentException, AesException {
        String msgSignature = request.getParameter("msg_signature");
        LOGGER.info("第三方平台全网发布-------------{appid}/callback-----------验证开始。。。。msg_signature=" + msgSignature);
        if (!StringUtils.isNotBlank(msgSignature)) {
            return;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息
        }
        StringBuilder sb = new StringBuilder();
        BufferedReader in = request.getReader();
        String line;
        while ((line = in.readLine()) != null) {
            sb.append(line);
        }
        in.close();
 
        String xml = sb.toString();
        Document doc = DocumentHelper.parseText(xml);
        Element rootElt = doc.getRootElement();
        String toUserName = rootElt.elementText("ToUserName");
 
        //微信全网测试账号
//        if (StringUtils.equalsIgnoreCase(toUserName, APPID)) {
        LOGGER.info("全网发布接入检测消息反馈开始---------------APPID=" + appid + "------------------------toUserName=" + toUserName);
        checkWeixinAllNetworkCheck(request, response, xml);
//        }
    }
}
3 回复

appid麻烦提供下

@RequestMapping(value ="/{APPID}/xxsCallback" ,送给被他误导的人,我调了半天

使用审核结果查询接口获取结果信息

回到顶部