}); weixin.eventMsg(function(msg){ console.log(msg); fs.mkdir("./usersdata/"+msg.fromUserName); fs.mkdir("./usersdata/"+msg.fromUserName+"/pic"); var articles = []; articles[0] = { title : "汪!汪!汪!", description : "主任,我等了你500年!你终于来了", picUrl : "http://t0.gstatic.com/images?q=tbn:ANd9GcQMDChOdBwBGo-qvF6S4o-b1nb4eTSrcwJphupfwrF4A2CRVj1K", url : "https://status.github.com/" }; if(msg.event == "subscribe"){ resMsg = { fromUserName : msg.toUserName, toUserName : msg.fromUserName, msgType : "news", articles : articles, funcFlag : 0 } weixin.sendMsg(resMsg); } }); app.post('/', function(req, res) {
// 监听位置消息 weixin.locationMsg(function(msg) { console.log("locationMsg received"); console.log(JSON.stringify(msg)); }); // 监听链接消息 weixin.urlMsg(function(msg) { console.log("urlMsg received"); console.log(JSON.stringify(msg)); }); // 监听事件消息 weixin.eventMsg(function(msg) { console.log("eventMsg received"); console.log(JSON.stringify(msg)); }); // Start app.post('/', function(req, res) { // loop weixin.loop(req, res); }); //app.js app.get('/index', function(req, res) { res.end('hello world'); }); //静态资源