Authored by 郭成尧

student-market

@@ -8,6 +8,7 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model @@ -8,6 +8,7 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model
8 const _ = require('lodash'); 8 const _ = require('lodash');
9 const productProcess = require(`${global.utils}/product-process`); 9 const productProcess = require(`${global.utils}/product-process`);
10 const stdntMrktModel = require('../models/student-market'); 10 const stdntMrktModel = require('../models/student-market');
  11 +const yasProcess = require(`${global.utils}/yas-process`);
11 12
12 const userAcquireStatus = (uid, couponIds) => { 13 const userAcquireStatus = (uid, couponIds) => {
13 if (couponIds !== '') { 14 if (couponIds !== '') {
@@ -197,10 +198,21 @@ exports.index = (req, res, next) => { @@ -197,10 +198,21 @@ exports.index = (req, res, next) => {
197 exports.newIndex = (req, res, next) => { 198 exports.newIndex = (req, res, next) => {
198 stdntMrktModel.getStudentGoods({ 199 stdntMrktModel.getStudentGoods({
199 limit: req.query.limit || '60', 200 limit: req.query.limit || '60',
200 - stocknumber: req.query.stocknumber || '1' 201 + stocknumber: req.query.stocknumber || '1',
  202 + isApp: req.yoho.isApp
201 }).then(result => { 203 }).then(result => {
202 let title = '有货学生专享优惠'; 204 let title = '有货学生专享优惠';
203 205
  206 + if (req.yoho.isApp) {
  207 + _.forEach(result, goods => {
  208 + goods.url = yasProcess.addParamsToGoodsHref({
  209 + href: goods.url,
  210 + fromPageName: yasProcess.getPname(req),
  211 + fromPageParam: req.originalUrl
  212 + });
  213 + });
  214 + }
  215 +
204 res.render('student-market-new', { 216 res.render('student-market-new', {
205 title: title, 217 title: title,
206 pageHeader: headerModel.setNav({ 218 pageHeader: headerModel.setNav({
@@ -19,7 +19,7 @@ const getStudentGoods = (params) => { @@ -19,7 +19,7 @@ const getStudentGoods = (params) => {
19 limit: params.limit, 19 limit: params.limit,
20 stocknumber: params.stocknumber, 20 stocknumber: params.stocknumber,
21 }).then(result => { 21 }).then(result => {
22 - return productProcess.processProductList(_.get(result, 'data.product_list', [])); 22 + return productProcess.processProductList(_.get(result, 'data.product_list', []), {isApp: params.isApp});
23 }); 23 });
24 }; 24 };
25 25
@@ -44,11 +44,9 @@ const _handleOpenbyParams = (params) => { @@ -44,11 +44,9 @@ const _handleOpenbyParams = (params) => {
44 return params.openbyStr; 44 return params.openbyStr;
45 } 45 }
46 46
47 - if (!_.isEmpty(openByParamObj)) {  
48 - _.assign(openByParamObj, {  
49 - from_page_name: params.fromPageName,  
50 - from_page_param: params.fromPageParam  
51 - }); 47 + if (!_.isEmpty(openByParamObj) && _.has(openByParamObj, 'params')) {
  48 + openByParamObj.params.from_page_name = params.fromPageName;
  49 + openByParamObj.params.from_page_param = params.fromPageParam;
52 50
53 openByStrNew = `${paramsKeyStr}${JSON.stringify(openByParamObj)}`; 51 openByStrNew = `${paramsKeyStr}${JSON.stringify(openByParamObj)}`;
54 } 52 }