收藏
回答

小程序订阅消息phrase5数据怎么错误?

{

    "touser": "xxxxxx",

    "template_id": "xxxx",

    "page": "/page/gongdan/index",

    "data": {

        "thing7": {

            "value": "商务通海"

        },

        "thing6": {

            "value": "查看服务"

        },

        "thing2": {

            "value": "工商局递"

        },

        "phrase5": {

            "value": "待报名"

        }

    }

}


13:22:36.062 [main] DEBUG org.springframework.web.client.RestTemplate - HTTP GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=xxxxxx&secret=xxxxx

13:22:36.110 [main] DEBUG org.springframework.web.client.RestTemplate - Accept=[application/xml, text/xml, application/json, application/*+xml, application/*+json]

13:22:36.450 [main] DEBUG org.springframework.web.client.RestTemplate - Response 200 OK

13:22:36.452 [main] DEBUG org.springframework.web.client.RestTemplate - Reading to [xin.zhulin.component.weapp.subscribe.message.AccessToken]

{"touser":"xxxxx","template_id":"xxxxx","page":"/page/gongdan/index","data":{"thing7":{"value":"商务通海"},"thing6":{"value":"查看服务"},"thing2":{"value":"工商局递"},"phrase5":{"value":"待报名"}}}

13:22:36.511 [main] DEBUG org.springframework.web.client.RestTemplate - HTTP POST https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=....

13:22:36.511 [main] DEBUG org.springframework.web.client.RestTemplate - Accept=[text/plain, application/xml, text/xml, application/json, application/*+xml, application/*+json, */*]

13:22:36.512 [main] DEBUG org.springframework.web.client.RestTemplate - Writing [{"touser":"xxxxx","template_id":"xxxxx","page":"/page/gongdan/index","data":{"thing7":{"value":"商务通海"},"thing6":{"value":"查看服务"},"thing2":{"value":"工商局递"},"phrase5":{"value":"待报名"}}}] with org.springframework.http.converter.StringHttpMessageConverter

13:22:36.656 [main] DEBUG org.springframework.web.client.RestTemplate - Response 200 OK

13:22:36.657 [main] DEBUG org.springframework.web.client.RestTemplate - Reading to [java.lang.String] as "application/json;encoding=utf-8"

{"errcode":47003,"errmsg":"argument invalid! data.phrase5.value invalid rid: 6138489e-2737e3e3-5f80c795"}

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

2 个回答

  • 平凡
    平凡
    2021-09-08

    如何更改这个编码?

    2021-09-08
    有用
    回复
  • Mr.Zhao
    Mr.Zhao
    2021-09-08

    字数没超过五个,怀疑是中文编码问题


    RestTemplate restTemplate = new RestTemplate();
    restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
    


    2021-09-08
    有用
    回复 1
    • 平凡
      平凡
      2021-09-08
      非常感谢!解决了
      2021-09-08
      回复
登录 后发表内容