...
|
...
|
@@ -23,6 +23,8 @@ const uuid = require('uuid'); |
|
|
const _ = require('lodash');
|
|
|
const pkg = require('./package.json');
|
|
|
|
|
|
const cookie = require('./library/cookie');
|
|
|
|
|
|
const app = express();
|
|
|
const MemcachedStore = memcached(session);
|
|
|
|
...
|
...
|
@@ -71,6 +73,11 @@ app.use((req, res, next) => { |
|
|
if (req.session && _.isNumber(req.session._LOGIN_UID)) {
|
|
|
req.user.uid = req.session._LOGIN_UID;
|
|
|
}
|
|
|
|
|
|
// session 没有读取到的时候,从 cookie 读取 UID
|
|
|
if (!req.user.uid && req.cookies._UID) {
|
|
|
req.user.uid = cookie.getUid(req);
|
|
|
}
|
|
|
next();
|
|
|
});
|
|
|
|
...
|
...
|
|