Authored by 张文文

发现好货接口添加uid参数 review by lea.guo

@@ -6,8 +6,23 @@ exports.index = function(req, res, next) { @@ -6,8 +6,23 @@ exports.index = function(req, res, next) {
6 let qcdn = _.get(req.app.locals, 'wap.qcloud_cdn'); 6 let qcdn = _.get(req.app.locals, 'wap.qcloud_cdn');
7 const { page = 1 } = req.query || {}; 7 const { page = 1 } = req.query || {};
8 8
  9 + let app = req.query.app || {};
  10 + let app_session_key = app.session_key;
  11 + let uid = '';
  12 +
  13 + if (typeof req.user.uid !== 'undefined') {
  14 + uid = {
  15 + toString: () => {
  16 + return _.parseInt(req.user.uid);
  17 + },
  18 + sessionKey: app_session_key
  19 + };
  20 + } else {
  21 + uid = '';
  22 + }
  23 +
9 req.ctx(FindGoods) 24 req.ctx(FindGoods)
10 - .findGoods({ page }) 25 + .findGoods({ page, uid })
11 .then(result => { 26 .then(result => {
12 if (!result) { 27 if (!result) {
13 return next(); 28 return next();
@@ -49,8 +64,23 @@ exports.index = function(req, res, next) { @@ -49,8 +64,23 @@ exports.index = function(req, res, next) {
49 exports.fetchMore = function(req, res, next) { 64 exports.fetchMore = function(req, res, next) {
50 const { page = 1 } = req.query || {}; 65 const { page = 1 } = req.query || {};
51 66
  67 + let app = req.query.app || {};
  68 + let app_session_key = app.session_key;
  69 + let uid = '';
  70 +
  71 + if (typeof req.user.uid !== 'undefined') {
  72 + uid = {
  73 + toString: () => {
  74 + return _.parseInt(req.user.uid);
  75 + },
  76 + sessionKey: app_session_key
  77 + };
  78 + } else {
  79 + uid = '';
  80 + }
  81 +
52 req.ctx(FindGoods) 82 req.ctx(FindGoods)
53 - .findGoods({ page }) 83 + .findGoods({ page, uid })
54 .then(result => { 84 .then(result => {
55 if (!result) { 85 if (!result) {
56 return next(); 86 return next();