Authored by htoooth

获得uid的数据。

@@ -736,7 +736,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { @@ -736,7 +736,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
736 // 分享相关,产品的链接 736 // 分享相关,产品的链接
737 result.weixinUrl = helpers.urlFormat(origin.productUrl, {}, 'item'); 737 result.weixinUrl = helpers.urlFormat(origin.productUrl, {}, 'item');
738 result.shareTitle = result.name; 738 result.shareTitle = result.name;
739 - result.shareImg = result.img; 739 + result.shareImg = 'http:' + result.img;
740 result.shareDesc = result.phrase; 740 result.shareDesc = result.phrase;
741 741
742 // 统计需要的商品信息 742 // 统计需要的商品信息
1 'use strict'; 1 'use strict';
2 2
3 -const _ = require('lodash');  
4 const Fp = require('lodash/fp'); 3 const Fp = require('lodash/fp');
5 const cookie = global.yoho.cookie; 4 const cookie = global.yoho.cookie;
6 5
7 module.exports = () => { 6 module.exports = () => {
8 return (req, res, next) => { 7 return (req, res, next) => {
9 - // 从 SESSION 中获取到当前登录用户的 UID  
10 - if (req.session && _.isNumber(req.session._LOGIN_UID)) {  
11 - req.user.uid = req.session._LOGIN_UID;  
12 - }  
13 8
14 // session 没有读取到的时候,从 cookie 读取 UID 9 // session 没有读取到的时候,从 cookie 读取 UID
15 - if (!req.user.uid && req.cookies._UID) { 10 + if (req.cookies._UID) {
16 req.user.uid = cookie.getUid(req); 11 req.user.uid = cookie.getUid(req);
17 - }  
18 12
19 - // 获得vip 信息  
20 - if (req.user.uid && req.cookies._UID) {  
21 let getVip = Fp.pipe(Fp.split('::'), Fp.nth(2)); 13 let getVip = Fp.pipe(Fp.split('::'), Fp.nth(2));
22 14
23 req.user.vip = getVip(req.cookies._UID); 15 req.user.vip = getVip(req.cookies._UID);
24 } 16 }
25 17
  18 + // 从 SESSION 中获取到当前登录用户的 UID
  19 + // if (req.session && _.isNumber(req.session._LOGIN_UID)) {
  20 + // req.user.uid = req.session._LOGIN_UID;
  21 + // }
  22 +
26 next(); 23 next();
27 }; 24 };
28 }; 25 };