Authored by 郭成尧

process-product-name

  1 +/**
  2 + * Created by yoho on 2016/12/19.
  3 + */
  4 +
  5 +module.exports = function (nameStr) {
  6 + return nameStr.match(/\w/ig).join('');
  7 +};
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 require('../app'); 2 require('../app');
3 const _ = require('lodash'); 3 const _ = require('lodash');
4 const helpers = global.yoho.helpers; 4 const helpers = global.yoho.helpers;
  5 +const productNameProcess = require('./product-name-process');
5 6
6 /** 7 /**
7 * 根据性别来决定 默认图片获取字段 如果是 2、3 8 * 根据性别来决定 默认图片获取字段 如果是 2、3
@@ -128,6 +129,11 @@ exports.processProductList = (list, options) => { @@ -128,6 +129,11 @@ exports.processProductList = (list, options) => {
128 } 129 }
129 130
130 product.is_soon_sold_out = product.is_soon_sold_out === 'Y'; 131 product.is_soon_sold_out = product.is_soon_sold_out === 'Y';
  132 +
  133 + if (product.cn_alphabet) {
  134 + product.cn_alphabet = productNameProcess(product.cn_alphabet);
  135 + }
  136 +
131 product.url = helpers.urlFormat(`/product/pro_${product.product_id}_${product.goods_list[0].goods_id}/${product.cn_alphabet}.html`); // eslint-disable-line 137 product.url = helpers.urlFormat(`/product/pro_${product.product_id}_${product.goods_list[0].goods_id}/${product.cn_alphabet}.html`); // eslint-disable-line
132 138
133 // APP访问需要加附加的参数 139 // APP访问需要加附加的参数