收藏
回答

被动回复消息,安卓与苹果收到的消息不同?

@PostMapping(produces = "application/xml; charset=UTF-8")
    public String post(@PathVariable("appId") String appId, @RequestBody String requestBody,
                       @RequestParam(value = "signature",required = false) String signature,
                       @RequestParam(value = "timestamp",required = false) String timestamp,
                       @RequestParam(value = "nonce",required = false) String nonce,
                       @RequestParam(value = "openid",required = false) String openid,
                       @RequestParam(value = "encType",required = false) String encType,
                       @RequestParam(value = "msgSignature",required = false) String msgSignature) {
        logger.info("接收微信公众号请求:[openid=[{}], [signature=[{}], encType=[{}], msgSignature=[{}],"
                        + " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
                openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
        ChatChannel channel = chatChannelService.getFromAppId(appId);
        if (channel == null) return null;
//        if (!wxMpService.checkSignature(timestamp, nonce, signature)) {
//            throw new IllegalArgumentException("非法请求,可能属于伪造的请求!");
//        }
        WxMpService wxMpService = chatWxService.getWxMpService(appId);
        WxMpXmlMessage inMessage = null;
        WxMpXmlOutMessage outMessage = null;
        String result = null;
        if (encType == null) {
            inMessage = WxMpXmlMessage.fromXml(requestBody);
        } else if ("aes".equalsIgnoreCase(encType)) {
            inMessage = WxMpXmlMessage.fromEncryptedXml(requestBody, wxMpService.getWxMpConfigStorage(),
                    timestamp, nonce, msgSignature);
        }
        logger.info("接收微信公众号请求解密:{},{}", appId, inMessage);
        if (inMessage != null) {
            if (inMessage.getMsgType().equals(WxConsts.XmlMsgType.EVENT)) {
                return chatWxService.eventHandle(appId, signature, timestamp, nonce, openid, encType, msgSignature, requestBody, inMessage, channel.getAesKey());
            } else {
                outMessage = chatWxService.msgHandle(appId, inMessage);
            }
        }
        if (encType == null && outMessage != null) {
            result = outMessage.toXml();
        } else if ("aes".equalsIgnoreCase(encType) && outMessage != null) {
            result = outMessage.toEncryptedXml(wxMpService.getWxMpConfigStorage());
        }
        logger.info("公众号组装回复信息:{}", result);
        return result;
    }



代码如上:通过被动回复来回复一些内容,为纯文本+超链接。

1.经过测试得到的效果安卓手机和苹果手机收到的内容不一致。安卓从第二个超链接的后面内容会不显示

2.被动回复内容如果带有html标签也就是富文本形式,是否可以被识别到。例如换行,加粗等

回答关注问题邀请回答
收藏

2 个回答

  • 社区技术运营专员--许涛
    社区技术运营专员--许涛
    8小时前

    你好,提供一个具体的case说明问题和截图

    8小时前
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    2天前
    有用
登录 后发表内容