Nodejs 微信开发 新用户关注事件
$ npm install wechat --save
关注事件代码片段:
var router = express.Router(); router.use('/wechat', wechat('wechatToken', function (req, res, next) { // 微信输入信息都在req.weixin上 var message = req.weixin; if((message.MsgType == 'event') && (message.Event == 'subscribe')) { var refillStr = "<a href=\"http://your_IP/weixin/refill?weixinId=" + message.FromUserName + "\">1. 点击记录团队充值"+message.ToUserName+"</a>" var consumeStr = "<a href=\"http://your_IP/weixin/consume?weixinId=" + message.FromUserName + "\">2. 点击记录团队消费"+message.FromUserName+"</a>" var deleteStr = "<a href=\"http://your_IP/weixin/delete?weixinId=" + message.FromUserName + "\">3. 点击回退记录"+message.MsgType+"</a>" var historyStr = "<a href=\"http://your_IP/weixin/history?weixinId=" + message.FromUserName + "\">4. 点击查询历史记录"+message.Event+"</a>" var emptyStr = " "; var replyStr = "感谢你的关注!" + "\n"+ emptyStr + "\n" + refillStr + "\n"+ emptyStr + "\n" + consumeStr + "\n"+ emptyStr + "\n" + deleteStr + "\n"+ emptyStr + "\n" + historyStr; res.reply(replyStr); } }));
效果图:
相关推荐
swazerz 2020-05-16
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23