Skip to content

Commit

Permalink
某人觉得md5运算的块要单独提出来,后来又提到其实不做md5也一样,另外的某人一琢磨也对,就提交了
Browse files Browse the repository at this point in the history
  • Loading branch information
realdog committed Aug 13, 2013
1 parent a23bf6e commit 4fb4e4e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/wechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,8 @@ var respond = function (handler) {
var storage = req.sessionStore;
var _end = res.end;
var userOpenid = message.FromUserName;
var serviceOpenid = message.ToUserName;
var _str = serviceOpenid + ":" + userOpenid;
var _hash = crypto.createHash("md5");
_hash.update(_str);
var _hashmsg = _hash.digest('hex');
var hashid = _hashmsg.toString();
var SPOpenid = message.ToUserName;
var mixId = SPOpenid + ":" + userOpenid;
res.end = function () {
_end.apply(res, arguments);
if (req.wxsession) {
Expand Down Expand Up @@ -172,12 +168,12 @@ var respond = function (handler) {
res.reply.apply(res, arguments);
};

storage.get(hashid, function (err, session) {
storage.get(mixId, function (err, session) {
if (!session) {
req.wxsession = new Session(hashid, req);
req.wxsession = new Session(mixId, req);
req.wxsession.cookie = req.session.cookie;
} else {
req.wxsession = new Session(hashid, req, session);
req.wxsession = new Session(mixId, req, session);
}
done();
});
Expand Down

0 comments on commit 4fb4e4e

Please sign in to comment.