标签:blog io os ar java div c on cti
var crypto = require(‘crypto‘); app.get(‘/api/wx/test‘,function(req,res){ if (req.query) { var arr = []; var signature = req.query["signature"]; var timestamp = req.query["timestamp"]; var nonce = req.query["nonce"]; var echostr = req.query["echostr"]; var token = ‘tjntv‘; arr.push(token,timestamp,nonce); arr.sort(); var str = arr.join(‘‘); var md5sum = crypto.createHash(‘sha1‘); str = md5sum.update(str); if ( str == signature ) { res.send(echostr); } else { console.log(‘22222222222222‘); } } else { console.log(‘11111111111111‘); return false; } });
标签:blog io os ar java div c on cti
原文地址:http://www.cnblogs.com/league7/p/4001595.html