Showing
6 changed files
with
39 additions
and
0 deletions
1 | 'use strict'; | 1 | 'use strict'; |
2 | + | ||
3 | +const productNameProcess = require(`${utils}/product-name-process`); | ||
2 | const serviceApi = global.yoho.ServiceAPI; | 4 | const serviceApi = global.yoho.ServiceAPI; |
3 | const api = global.yoho.API; | 5 | const api = global.yoho.API; |
4 | const helpers = global.yoho.helpers; | 6 | const helpers = global.yoho.helpers; |
@@ -224,6 +226,11 @@ exports.index = (req, res, next) => { | @@ -224,6 +226,11 @@ exports.index = (req, res, next) => { | ||
224 | datas[1].data = datas[1].data || {}; | 226 | datas[1].data = datas[1].data || {}; |
225 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { | 227 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { |
226 | value.goodsId = value.goods_list[0].goods_id; | 228 | value.goodsId = value.goods_list[0].goods_id; |
229 | + | ||
230 | + if (value.cn_alphabet) { | ||
231 | + value.cn_alphabet = productNameProcess(value.cn_alphabet); | ||
232 | + } | ||
233 | + | ||
227 | value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; | 234 | value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; |
228 | return value; | 235 | return value; |
229 | }); | 236 | }); |
@@ -368,6 +375,11 @@ exports.verifystudent = (req, res, next) => { | @@ -368,6 +375,11 @@ exports.verifystudent = (req, res, next) => { | ||
368 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { | 375 | datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) { |
369 | value.goodsId = value.goods_list[0].goods_id; | 376 | value.goodsId = value.goods_list[0].goods_id; |
370 | value.product_id = value.product_id; | 377 | value.product_id = value.product_id; |
378 | + | ||
379 | + if (value.cn_alphabet) { | ||
380 | + value.cn_alphabet = productNameProcess(value.cn_alphabet); | ||
381 | + } | ||
382 | + | ||
371 | value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; | 383 | value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; |
372 | return value; | 384 | return value; |
373 | }); | 385 | }); |
1 | 'use strict'; | 1 | 'use strict'; |
2 | + | ||
3 | +const productNameProcess = require(`${utils}/product-name-process`); | ||
2 | const api = global.yoho.API; | 4 | const api = global.yoho.API; |
3 | const serviceAPI = global.yoho.ServiceAPI; | 5 | const serviceAPI = global.yoho.ServiceAPI; |
4 | const _ = require('lodash'); | 6 | const _ = require('lodash'); |
@@ -179,6 +181,10 @@ const getNewProduct = (brandId, gender, url, isApp) => { | @@ -179,6 +181,10 @@ const getNewProduct = (brandId, gender, url, isApp) => { | ||
179 | 181 | ||
180 | newArrival.moreUrl = url; | 182 | newArrival.moreUrl = url; |
181 | 183 | ||
184 | + if (list.cn_alphabet) { | ||
185 | + list.cn_alphabet = productNameProcess(list.cn_alphabet); | ||
186 | + } | ||
187 | + | ||
182 | let productUrl = '//m.yohobuy.com/product/pro_' + list.product_id + '_' + | 188 | let productUrl = '//m.yohobuy.com/product/pro_' + list.product_id + '_' + |
183 | list.goods_list[0].goods_id + '/' + list.cn_alphabet + '.html'; | 189 | list.goods_list[0].goods_id + '/' + list.cn_alphabet + '.html'; |
184 | 190 |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | +const productNameProcess = require(`${utils}/product-name-process`); | ||
3 | const api = global.yoho.API; | 4 | const api = global.yoho.API; |
4 | const _ = require('lodash'); | 5 | const _ = require('lodash'); |
5 | const serviceAPI = global.yoho.ServiceAPI; | 6 | const serviceAPI = global.yoho.ServiceAPI; |
@@ -97,6 +98,10 @@ const selectHotrank = (yhChannel, gender, sort, tabId, limit, page, notab) => { | @@ -97,6 +98,10 @@ const selectHotrank = (yhChannel, gender, sort, tabId, limit, page, notab) => { | ||
97 | return false; | 98 | return false; |
98 | } | 99 | } |
99 | 100 | ||
101 | + if (data.cn_alphabet) { | ||
102 | + data.cn_alphabet = productNameProcess(data.cn_alphabet); | ||
103 | + } | ||
104 | + | ||
100 | one = _.assign(one, { | 105 | one = _.assign(one, { |
101 | url: '/product/pro_' + data.product_id + '_' + data.goods_list[0].goods_id + | 106 | url: '/product/pro_' + data.product_id + '_' + data.goods_list[0].goods_id + |
102 | '/' + data.cn_alphabet + '.html', | 107 | '/' + data.cn_alphabet + '.html', |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | 7 | ||
8 | 'use strict'; | 8 | 'use strict'; |
9 | const _ = require('lodash'); | 9 | const _ = require('lodash'); |
10 | +const productNameProcess = require(`${utils}/product-name-process`); | ||
10 | 11 | ||
11 | const api = global.yoho.API; | 12 | const api = global.yoho.API; |
12 | const helpers = global.yoho.helpers; | 13 | const helpers = global.yoho.helpers; |
@@ -27,6 +28,10 @@ const _formatProduct = (data) => { | @@ -27,6 +28,10 @@ const _formatProduct = (data) => { | ||
27 | } | 28 | } |
28 | value.goodsId = value.goods_list[0].goods_id; | 29 | value.goodsId = value.goods_list[0].goods_id; |
29 | 30 | ||
31 | + if (value.cn_alphabet) { | ||
32 | + value.cn_alphabet = productNameProcess(value.cn_alphabet); | ||
33 | + } | ||
34 | + | ||
30 | let goods = { | 35 | let goods = { |
31 | salePrice: value.sales_price ? value.sales_price : '', | 36 | salePrice: value.sales_price ? value.sales_price : '', |
32 | price: value.market_price ? value.market_price : '', | 37 | price: value.market_price ? value.market_price : '', |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | +const productNameProcess = require(`${utils}/product-name-process`); | ||
3 | var api = global.yoho.API; | 4 | var api = global.yoho.API; |
4 | const helpers = global.yoho.helpers; | 5 | const helpers = global.yoho.helpers; |
5 | const _ = require('lodash'); | 6 | const _ = require('lodash'); |
@@ -23,6 +24,10 @@ const getPreferenceData = (data) => { | @@ -23,6 +24,10 @@ const getPreferenceData = (data) => { | ||
23 | } | 24 | } |
24 | value.goodsId = value.goods_list && value.goods_list[0] && value.goods_list[0].goods_id; | 25 | value.goodsId = value.goods_list && value.goods_list[0] && value.goods_list[0].goods_id; |
25 | 26 | ||
27 | + if (value.cn_alphabet) { | ||
28 | + value.cn_alphabet = productNameProcess(value.cn_alphabet); | ||
29 | + } | ||
30 | + | ||
26 | let goods = { | 31 | let goods = { |
27 | product_skn: value.product_skn, | 32 | product_skn: value.product_skn, |
28 | product_name: value.product_name, | 33 | product_name: value.product_name, |
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | 4 | ||
5 | 'use strict'; | 5 | 'use strict'; |
6 | const helpers = global.yoho.helpers; | 6 | const helpers = global.yoho.helpers; |
7 | +const productNameProcess = require('./product-name-process'); | ||
7 | 8 | ||
8 | /** | 9 | /** |
9 | * [将首字符为//的url转换为http://] | 10 | * [将首字符为//的url转换为http://] |
@@ -275,6 +276,11 @@ const formatProduct = (productData, showTags, showNew, showSale, width, height, | @@ -275,6 +276,11 @@ const formatProduct = (productData, showTags, showNew, showSale, width, height, | ||
275 | // TODO student price | 276 | // TODO student price |
276 | result.studentPrice = parseInt(productData.sales_price * 100 * 0.9) / 100; | 277 | result.studentPrice = parseInt(productData.sales_price * 100 * 0.9) / 100; |
277 | result.is_soon_sold_out = (productData.is_soon_sold_out === 'Y'); | 278 | result.is_soon_sold_out = (productData.is_soon_sold_out === 'Y'); |
279 | + | ||
280 | + if (productData.cn_alphabet) { | ||
281 | + productData.cn_alphabet = productNameProcess(productData.cn_alphabet); | ||
282 | + } | ||
283 | + | ||
278 | let url = encodeURI(helpers.urlFormat(`/product/pro_${productData.product_id}_${productData.goods_list[0].goods_id}/${productData.cn_alphabet}.html`)); | 284 | let url = encodeURI(helpers.urlFormat(`/product/pro_${productData.product_id}_${productData.goods_list[0].goods_id}/${productData.cn_alphabet}.html`)); |
279 | 285 | ||
280 | result.url = url.replace('http://', '//'); | 286 | result.url = url.replace('http://', '//'); |
-
Please register or login to post a comment