Showing
5 changed files
with
8 additions
and
43 deletions
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -const utils = '../../../utils'; | ||
4 | -const productNameProcess = require(`${utils}/product-name-process`); | ||
5 | const helpers = global.yoho.helpers; | 3 | const helpers = global.yoho.helpers; |
6 | const crypto = global.yoho.crypto; | 4 | const crypto = global.yoho.crypto; |
7 | const queryString = require('querystring'); | 5 | const queryString = require('querystring'); |
@@ -131,15 +129,8 @@ exports.index = (req, res, next) => { | @@ -131,15 +129,8 @@ exports.index = (req, res, next) => { | ||
131 | return item; | 129 | return item; |
132 | }); | 130 | }); |
133 | 131 | ||
134 | - | ||
135 | datas[1].data = datas[1].data || {}; | 132 | datas[1].data = datas[1].data || {}; |
136 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { | 133 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { |
137 | - value.goodsId = value.goods_list[0].goods_id; | ||
138 | - | ||
139 | - if (value.cn_alphabet) { | ||
140 | - value.cn_alphabet = productNameProcess(value.cn_alphabet); | ||
141 | - } | ||
142 | - | ||
143 | // 商品url改版 | 134 | // 商品url改版 |
144 | value.url = helpers.urlFormat(`/product/${value.product_skn}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; // eslint-disable-line | 135 | value.url = helpers.urlFormat(`/product/${value.product_skn}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; // eslint-disable-line |
145 | return value; | 136 | return value; |
@@ -189,7 +180,6 @@ exports.index = (req, res, next) => { | @@ -189,7 +180,6 @@ exports.index = (req, res, next) => { | ||
189 | } | 180 | } |
190 | } | 181 | } |
191 | 182 | ||
192 | - // console.log(options); | ||
193 | options.studentSwitch = !_.get(req.app.locals.wap, 'user.removeStudentIdentification', true); | 183 | options.studentSwitch = !_.get(req.app.locals.wap, 'user.removeStudentIdentification', true); |
194 | res.render('student', options); | 184 | res.render('student', options); |
195 | }); | 185 | }); |
@@ -337,13 +327,6 @@ exports.verifystudent = (req, res, next) => { | @@ -337,13 +327,6 @@ exports.verifystudent = (req, res, next) => { | ||
337 | }); | 327 | }); |
338 | } | 328 | } |
339 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { | 329 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { |
340 | - value.goodsId = value.goods_list[0].goods_id; | ||
341 | - value.product_id = value.product_id; | ||
342 | - | ||
343 | - if (value.cn_alphabet) { | ||
344 | - value.cn_alphabet = productNameProcess(value.cn_alphabet); | ||
345 | - } | ||
346 | - | ||
347 | // 商品url改版 | 330 | // 商品url改版 |
348 | value.url = helpers.urlFormat(`/product/${value.product_skn}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; // eslint-disable-line | 331 | value.url = helpers.urlFormat(`/product/${value.product_skn}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; // eslint-disable-line |
349 | return value; | 332 | return value; |
@@ -2,8 +2,6 @@ | @@ -2,8 +2,6 @@ | ||
2 | 2 | ||
3 | const helpers = global.yoho.helpers; | 3 | const helpers = global.yoho.helpers; |
4 | const _ = require('lodash'); | 4 | const _ = require('lodash'); |
5 | -const utils = '../../../utils'; | ||
6 | -const productNameProcess = require(`${utils}/product-name-process`); | ||
7 | 5 | ||
8 | class storeHome extends global.yoho.BaseModel { | 6 | class storeHome extends global.yoho.BaseModel { |
9 | constructor(ctx) { | 7 | constructor(ctx) { |
@@ -19,14 +17,9 @@ class storeHome extends global.yoho.BaseModel { | @@ -19,14 +17,9 @@ class storeHome extends global.yoho.BaseModel { | ||
19 | 17 | ||
20 | _.forEach(list && list.product_list, value => { | 18 | _.forEach(list && list.product_list, value => { |
21 | 19 | ||
22 | - if (!value.product_skn || !value.goods_list || !value.goods_list.length) { | 20 | + if (!value.product_skn) { |
23 | return; | 21 | return; |
24 | } | 22 | } |
25 | - value.goodsId = value.goods_list && value.goods_list[0] && value.goods_list[0].goods_id; | ||
26 | - | ||
27 | - if (value.cn_alphabet) { | ||
28 | - value.cn_alphabet = productNameProcess(value.cn_alphabet); | ||
29 | - } | ||
30 | 23 | ||
31 | let detailUrl = helpers.urlFormat(`/product/${value.product_skn}.html`); | 24 | let detailUrl = helpers.urlFormat(`/product/${value.product_skn}.html`); |
32 | 25 |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -const utils = '../../../utils'; | ||
4 | -const productNameProcess = require(`${utils}/product-name-process`); | ||
5 | const _ = require('lodash'); | 3 | const _ = require('lodash'); |
6 | const serviceAPI = global.yoho.ServiceAPI; | 4 | const serviceAPI = global.yoho.ServiceAPI; |
7 | const logger = global.yoho.logger; | 5 | const logger = global.yoho.logger; |
@@ -106,14 +104,10 @@ module.exports = class extends global.yoho.BaseModel { | @@ -106,14 +104,10 @@ module.exports = class extends global.yoho.BaseModel { | ||
106 | _.forEach(result.data.product_list, function(data, index) { | 104 | _.forEach(result.data.product_list, function(data, index) { |
107 | let one = {}; | 105 | let one = {}; |
108 | 106 | ||
109 | - if (data === null || !data.product_skn || !data.goods_list[0]) { | 107 | + if (data === null || !data.product_skn) { |
110 | return false; | 108 | return false; |
111 | } | 109 | } |
112 | 110 | ||
113 | - if (data.cn_alphabet) { | ||
114 | - data.cn_alphabet = productNameProcess(data.cn_alphabet); | ||
115 | - } | ||
116 | - | ||
117 | one = _.assign(one, { | 111 | one = _.assign(one, { |
118 | url: '/product/' + data.product_skn + '.html', // 商品url改版 | 112 | url: '/product/' + data.product_skn + '.html', // 商品url改版 |
119 | thumb: data.default_images, | 113 | thumb: data.default_images, |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -const utils = '../../../utils'; | ||
4 | -const productNameProcess = require(`${utils}/product-name-process`); | ||
5 | const helpers = global.yoho.helpers; | 3 | const helpers = global.yoho.helpers; |
6 | const _ = require('lodash'); | 4 | const _ = require('lodash'); |
7 | 5 | ||
@@ -19,14 +17,9 @@ const getPreferenceData = (data) => { | @@ -19,14 +17,9 @@ const getPreferenceData = (data) => { | ||
19 | 17 | ||
20 | _.forEach(list && list.product_list, value => { | 18 | _.forEach(list && list.product_list, value => { |
21 | 19 | ||
22 | - if (!value.product_skn || !value.goods_list || !value.goods_list.length) { | 20 | + if (!value || !value.product_skn) { |
23 | return; | 21 | return; |
24 | } | 22 | } |
25 | - value.goodsId = value.goods_list && value.goods_list[0] && value.goods_list[0].goods_id; | ||
26 | - | ||
27 | - if (value.cn_alphabet) { | ||
28 | - value.cn_alphabet = productNameProcess(value.cn_alphabet); | ||
29 | - } | ||
30 | 23 | ||
31 | let goods = { | 24 | let goods = { |
32 | product_skn: value.product_skn, | 25 | product_skn: value.product_skn, |
1 | 'use strict'; | 1 | 'use strict'; |
2 | require('../app'); | 2 | require('../app'); |
3 | const _ = require('lodash'); | 3 | const _ = require('lodash'); |
4 | +const imageHandle = require('./image'); | ||
4 | const helpers = global.yoho.helpers; | 5 | const helpers = global.yoho.helpers; |
5 | const GENDER = { | 6 | const GENDER = { |
6 | 1: '男', | 7 | 1: '男', |
@@ -113,9 +114,7 @@ exports.processProductList = (list, options) => { | @@ -113,9 +114,7 @@ exports.processProductList = (list, options) => { | ||
113 | // } | 114 | // } |
114 | 115 | ||
115 | // 商品信息有问题,则不显示 | 116 | // 商品信息有问题,则不显示 |
116 | - if (!( | ||
117 | - (product.product_skn && _.get(product, 'goods_list.length', 0)) || product.recommend_type | ||
118 | - )) { | 117 | + if (!product || !product.product_skn) { |
119 | return; | 118 | return; |
120 | } | 119 | } |
121 | 120 | ||
@@ -173,6 +172,9 @@ exports.processProductList = (list, options) => { | @@ -173,6 +172,9 @@ exports.processProductList = (list, options) => { | ||
173 | // if (!flag) { | 172 | // if (!flag) { |
174 | // product.default_images = _procProductImg(product.goods_list[0], product.gender, options.yh_channel); | 173 | // product.default_images = _procProductImg(product.goods_list[0], product.gender, options.yh_channel); |
175 | // } | 174 | // } |
175 | + // | ||
176 | + | ||
177 | + product.default_images = imageHandle.getSourceUrl(product.default_images, 'goodsimg'); | ||
176 | 178 | ||
177 | product.is_soon_sold_out = product.is_soon_sold_out === 'Y'; | 179 | product.is_soon_sold_out = product.is_soon_sold_out === 'Y'; |
178 | 180 |
-
Please register or login to post a comment