码迷,mamicode.com
首页 > 微信 > 详细

微信点击弹框

时间:2015-04-07 15:33:15      阅读:301      评论:0      收藏:0      [点我收藏+]

标签:

if (eventType.equalsIgnoreCase(MessageUtil.EVENT_TYPE_CLICK)) {
                    // 事件KEY值,与创建自定义菜单时指定的KEY值对应
                    String eventKey = requestMap.get("EventKey");
                    if (eventKey.equals("CONTACT_US")) {
                        NewsMessage newsMessage = buildmessage(open_id, toUserName, 1);
                        // 将图文消息对象转换成xml字符串
                        respMessage = MessageUtil.newsMessageToXml(newsMessage);
                    }

                }
private NewsMessage buildmessage(String open_id, String toUserName, Integer type) { // 创建图文消息 NewsMessage newsMessage = new NewsMessage(); newsMessage.setToUserName(open_id); newsMessage.setFromUserName(toUserName); newsMessage.setCreateTime(new Date().getTime()); newsMessage.setMsgType(MessageUtil.RESP_MESSAGE_TYPE_NEWS); newsMessage.setFuncFlag(0); List<WelMsgEntity> welMsgEntities = welMsgService.findAll(type); List<WelMsgEntity> needlist = new ArrayList<WelMsgEntity>(); if (welMsgEntities.size() > 0) { for (WelMsgEntity welMsgEntity : welMsgEntities) { if (needlist.size() < 8) { needlist.add(welMsgEntity); } } } List<Article> articleList = new ArrayList<Article>(); for (WelMsgEntity welMsgEntity : needlist) { Article article = new Article(); article.setTitle(welMsgEntity.getTitle()); article.setDescription(welMsgEntity.getDescription()); article.setPicUrl(fileURLPrefix + welMsgEntity.getPicurl()); article.setUrl(welMsgEntity.getUrl()); articleList.add(article); } // 设置图文消息个数 newsMessage.setArticleCount(articleList.size()); // 设置图文消息包含的图文集合 newsMessage.setArticles(articleList); return newsMessage; }

 

if (eventType.equalsIgnoreCase(MessageUtil.EVENT_TYPE_CLICK)) {
                    // 事件KEY值,与创建自定义菜单时指定的KEY值对应
                    String eventKey = requestMap.get("EventKey");
                    if (eventKey.equals("CONTACT_US")) {
                        NewsMessage newsMessage = buildmessage(open_id, toUserName, 1);
                        // 将图文消息对象转换成xml字符串
                        respMessage = MessageUtil.newsMessageToXml(newsMessage);
                    }

                }

微信点击弹框

标签:

原文地址:http://www.cnblogs.com/yaoyao66123/p/4398311.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!