频道栏目
首页 > 资讯 > 微信公众平台开发 > 正文

一起艳学Springboot开发微信公众号(二)

17-12-23        来源:[db:作者]  
收藏   我要投稿

一起艳学Springboot开发微信公众号(二)

消息的接收与回复:

文本消息 图文消息 音乐消息 图片消息 地理位置消息 链接消息 音频消息 事件推送

文本消息

respContent = "欢迎关注 "+logo+" ! 我们会竭力为您提供更多精彩的内容!"
                            + "\n\n回复 1 , 2 , 3 ,... 查看更多的内容!"; 

图文消息

Article article = new Article();
                    article.setTitle("艳辉——推荐蜗蜗");
                    article.setDescription("我做微商的原则是:" + "①有产品,自己先用,用得好,和小伙伴们分享" + "②不推销,我每天发圈,只是想告诉小伙伴们我一直在做"
                            + "③不夸大,东西有多好,咨询我,我会告诉你");
                    article.setPicUrl("https://upload.cc/i/rmYMvH.jpg");
                    article.setUrl("https://user.qzone.qq.com/934247746");
                    articleList.add(article);

音乐消息

Music music = new Music();
                        music.setTitle("我爱他");
                        music.setDescription("我爱他-丁当");
                        music.setMusicUrl("http://dl.loveq.cn/program/2017/LoveQ.cn_2017-12-17-1.mp3");
                        music.setHQMusicUrl("http://dl.loveq.cn/program/2017/LoveQ.cn_2017-12-17-1.mp3");

图片消息

// 取得图片地址
                String picUrl = requestMap.get("PicUrl");
                // 人脸检测
                String detectResult = FaceService.detect(picUrl);
                textMessage.setContent(detectResult);
                return MessageUtil.messageToXml(textMessage);

地理位置消息

// 用户发送的经纬度  
                String lng = requestMap.get("Location_Y");  
                String lat = requestMap.get("Location_X");  
                // 坐标转换后的经纬度  
                String bd09Lng = null;  
                String bd09Lat = null;  
                // 调用接口转换坐标  
                UserLocation userLocation = BaiduMapUtil.convertCoord(lng, lat);  
                if (null != userLocation) {  
                    bd09Lng = userLocation.getBd09Lng();  
                    bd09Lat = userLocation.getBd09Lat();  
                }  
//                logger.info("lng= " + lng + "; lat= " + lat);  
//                logger.info("bd09Lng= " + bd09Lng + "; bd09Lat= " + bd09Lat);  

                // 保存用户地理位置  
//                int count = userLocationDao.saveUserLocation(fromUserName, lng, lat, bd09Lng, bd09Lat);
                com.yanhui.weixin.pojo.UserLocation userLocation2 = new com.yanhui.weixin.pojo.UserLocation(null,fromUserName, lng, lat, bd09Lng, bd09Lat);
                int count = userLocationMapper.insert(userLocation2);

链接消息

 respContent = "您发送的是链接消息!";  

音频消息

 respContent = "您发送的是音频消息!";  

事件推送

 respContent = "您发送的是事件推送!";     --用拦截器实现用户关注获取用户信息,返回关注语言文字,和取消关注。
相关TAG标签
上一篇:编程开发Dynamic Ranking
下一篇:C.Digital Root(数论)求解
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站