qq_38432445
qq_38432445
2019-01-08 17:32

微信公众号 java关键字自动回复,图文消息 图片显示在右边怎么回事,最下方没有详情,他是以公众号头像回复的

10
  • 微信公众平台
  • java
  • 微信开放平台
  • 微信

就是正常情况下会是图片在最上方显示.最下边有详情二个字,而现在的情况就是图片在最右边,小图,而且没有详情二个字有公众号头像

微信公众号 java关键字自动回复,图片显示太小,还有公众号头像怎么去掉
我第一次显示是正常的如下
图片说明
后来不知道怎么就变成这种的啦图片说明
连详情都没有啦

    PrintWriter writer = response.getWriter();
    ArticlesMessage message = MessageUtil.getBlogMessage(fromUserName, toUserName);
    respMsg = MessageUtil.parseMsgToXmlTwo(message);
    writer.print(respMsg);

    public static ArticlesMessage getBlogMessage(String fromUserName, String toUserName) {
        ArticlesMessage photo = new ArticlesMessage();
        photo.setToUserName(fromUserName);
        photo.setFromUserName(toUserName);
        photo.setCreateTime(new Date().getTime());
        photo.setMsgType("news");

        List<ArticlesItem> articles = new ArrayList<>();

        ArticlesItem item1 = new ArticlesItem();
        item1.setTitle(BaseConst.WECHAT.IMAGE_TITLE);
        item1.setDescription(BaseConst.WECHAT.IMAGE_DESC);
        item1.setPicUrl(BaseConst.WECHAT.IMAGE_URL);
        item1.setUrl(BaseConst.WECHAT.IMAGE_MESSAGE_URL);
        articles.add(item1);

        photo.setArticles(articles);
        photo.setArticleCount(articles.size());

        return photo;
    }

    public static String parseMsgToXmlTwo(ArticlesMessage msg) throws UnsupportedEncodingException {
        XStream xstream = new XStream(new DomDriver("UTF-8"));
        xstream.alias("xml", msg.getClass());
        xstream.alias("item", new ArticlesItem().getClass());
        String xml = xstream.toXML(msg);
        return xml;
    }

这是我返回的xml数据

<xml>
  <ToUserName>oshsdhg-cMnmmPDFAxVmvyxw</ToUserName>
  <FromUserName>gh_fdd8b5048c5f5dfs</FromUserName>
  <CreateTime>1546997361742</CreateTime>
  <MsgType>news</MsgType>
  <ArticleCount>1</ArticleCount>
  <Articles>
    <item>
      <Title>*******</Title>
      <Description>******.</Description>
      <PicUrl>*****/image/ed38b53b928941c9ad6cafc431772bae.png</PicUrl>
      <Url>www.baidu.com</Url>
    </item>
  </Articles>
</xml>

为什么就是显示的样式不对

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答