Authored by yyq

goods_list

'use strict';
const utils = '../../../utils';
const productNameProcess = require(`${utils}/product-name-process`);
const helpers = global.yoho.helpers;
const crypto = global.yoho.crypto;
const queryString = require('querystring');
... ... @@ -131,15 +129,8 @@ exports.index = (req, res, next) => {
return item;
});
datas[1].data = datas[1].data || {};
datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) {
value.goodsId = value.goods_list[0].goods_id;
if (value.cn_alphabet) {
value.cn_alphabet = productNameProcess(value.cn_alphabet);
}
// 商品url改版
value.url = helpers.urlFormat(`/product/${value.product_skn}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; // eslint-disable-line
return value;
... ... @@ -189,7 +180,6 @@ exports.index = (req, res, next) => {
}
}
// console.log(options);
options.studentSwitch = !_.get(req.app.locals.wap, 'user.removeStudentIdentification', true);
res.render('student', options);
});
... ... @@ -337,13 +327,6 @@ exports.verifystudent = (req, res, next) => {
});
}
datas[1].data.product_list = (datas[1].data.product_list || []).map(function(value) {
value.goodsId = value.goods_list[0].goods_id;
value.product_id = value.product_id;
if (value.cn_alphabet) {
value.cn_alphabet = productNameProcess(value.cn_alphabet);
}
// 商品url改版
value.url = helpers.urlFormat(`/product/${value.product_skn}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`; // eslint-disable-line
return value;
... ...
... ... @@ -2,8 +2,6 @@
const helpers = global.yoho.helpers;
const _ = require('lodash');
const utils = '../../../utils';
const productNameProcess = require(`${utils}/product-name-process`);
class storeHome extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -19,14 +17,9 @@ class storeHome extends global.yoho.BaseModel {
_.forEach(list && list.product_list, value => {
if (!value.product_skn || !value.goods_list || !value.goods_list.length) {
if (!value.product_skn) {
return;
}
value.goodsId = value.goods_list && value.goods_list[0] && value.goods_list[0].goods_id;
if (value.cn_alphabet) {
value.cn_alphabet = productNameProcess(value.cn_alphabet);
}
let detailUrl = helpers.urlFormat(`/product/${value.product_skn}.html`);
... ...
'use strict';
const utils = '../../../utils';
const productNameProcess = require(`${utils}/product-name-process`);
const _ = require('lodash');
const serviceAPI = global.yoho.ServiceAPI;
const logger = global.yoho.logger;
... ... @@ -106,14 +104,10 @@ module.exports = class extends global.yoho.BaseModel {
_.forEach(result.data.product_list, function(data, index) {
let one = {};
if (data === null || !data.product_skn || !data.goods_list[0]) {
if (data === null || !data.product_skn) {
return false;
}
if (data.cn_alphabet) {
data.cn_alphabet = productNameProcess(data.cn_alphabet);
}
one = _.assign(one, {
url: '/product/' + data.product_skn + '.html', // 商品url改版
thumb: data.default_images,
... ...
'use strict';
const utils = '../../../utils';
const productNameProcess = require(`${utils}/product-name-process`);
const helpers = global.yoho.helpers;
const _ = require('lodash');
... ... @@ -19,14 +17,9 @@ const getPreferenceData = (data) => {
_.forEach(list && list.product_list, value => {
if (!value.product_skn || !value.goods_list || !value.goods_list.length) {
if (!value || !value.product_skn) {
return;
}
value.goodsId = value.goods_list && value.goods_list[0] && value.goods_list[0].goods_id;
if (value.cn_alphabet) {
value.cn_alphabet = productNameProcess(value.cn_alphabet);
}
let goods = {
product_skn: value.product_skn,
... ...
'use strict';
require('../app');
const _ = require('lodash');
const imageHandle = require('./image');
const helpers = global.yoho.helpers;
const GENDER = {
1: '男',
... ... @@ -113,9 +114,7 @@ exports.processProductList = (list, options) => {
// }
// 商品信息有问题,则不显示
if (!(
(product.product_skn && _.get(product, 'goods_list.length', 0)) || product.recommend_type
)) {
if (!product || !product.product_skn) {
return;
}
... ... @@ -173,6 +172,9 @@ exports.processProductList = (list, options) => {
// if (!flag) {
// product.default_images = _procProductImg(product.goods_list[0], product.gender, options.yh_channel);
// }
//
product.default_images = imageHandle.getSourceUrl(product.default_images, 'goodsimg');
product.is_soon_sold_out = product.is_soon_sold_out === 'Y';
... ...