Authored by htoooth

获得uid的数据。

... ... @@ -736,7 +736,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
// 分享相关,产品的链接
result.weixinUrl = helpers.urlFormat(origin.productUrl, {}, 'item');
result.shareTitle = result.name;
result.shareImg = result.img;
result.shareImg = 'http:' + result.img;
result.shareDesc = result.phrase;
// 统计需要的商品信息
... ...
'use strict';
const _ = require('lodash');
const Fp = require('lodash/fp');
const cookie = global.yoho.cookie;
module.exports = () => {
return (req, res, next) => {
// 从 SESSION 中获取到当前登录用户的 UID
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) {
if (req.cookies._UID) {
req.user.uid = cookie.getUid(req);
}
// 获得vip 信息
if (req.user.uid && req.cookies._UID) {
let getVip = Fp.pipe(Fp.split('::'), Fp.nth(2));
req.user.vip = getVip(req.cookies._UID);
}
// 从 SESSION 中获取到当前登录用户的 UID
// if (req.session && _.isNumber(req.session._LOGIN_UID)) {
// req.user.uid = req.session._LOGIN_UID;
// }
next();
};
};
... ...