Authored by 陈轩

todo:境外订单数据

@@ -117,7 +117,7 @@ exports.fetchOrders = (req, res) => { @@ -117,7 +117,7 @@ exports.fetchOrders = (req, res) => {
117 117
118 imApi.fetchOrderList(uid) 118 imApi.fetchOrderList(uid)
119 .then(result => { 119 .then(result => {
120 - imModel.handleOrderList(result.data); 120 + imModel.handleOrderList(result.data, 128, 170);
121 res.json(result); 121 res.json(result);
122 }).catch(() =>{ 122 }).catch(() =>{
123 return res.json({ 123 return res.json({
@@ -158,7 +158,7 @@ exports.queryGlobalOrder = (req, res) => { @@ -158,7 +158,7 @@ exports.queryGlobalOrder = (req, res) => {
158 158
159 imApi.queryGlobalOrder(uid) 159 imApi.queryGlobalOrder(uid)
160 .then(result=> { 160 .then(result=> {
161 - imModel.handleOrderList(result.data); 161 + imModel.handleOrderList(result.data, 128, 170);
162 res.json(result); 162 res.json(result);
163 }, () => { 163 }, () => {
164 res.json(emptyOrder); 164 res.json(emptyOrder);
@@ -9,17 +9,28 @@ const _ = require('lodash'); @@ -9,17 +9,28 @@ const _ = require('lodash');
9 /** 9 /**
10 * function: 处理 订单返回的数据 10 * function: 处理 订单返回的数据
11 */ 11 */
12 -exports.handleOrderList = data => { 12 +exports.handleOrderList = (data, w, h) => {
13 if (_.isEmpty(data)) { 13 if (_.isEmpty(data)) {
14 return; 14 return;
15 } 15 }
16 16
  17 + function replaceWH(img) {
  18 + return img.replace(/(\{width\}|\{height\})/g, function($0) {
  19 + const dict = {
  20 + '{width}': w,
  21 + '{height}': h,
  22 + };
  23 +
  24 + return dict[$0];
  25 + });
  26 + }
  27 +
17 data.forEach(order => { 28 data.forEach(order => {
18 order.goods = order.ordersGoodsBoList.map(good => { 29 order.goods = order.ordersGoodsBoList.map(good => {
19 return { 30 return {
20 id: good.productSku, 31 id: good.productSku,
21 name: good.productName, 32 name: good.productName,
22 - thumb: good.imgUrl, 33 + thumb: replaceWH(good.imgUrl),
23 color: good.colorName, 34 color: good.colorName,
24 size: good.sizeName, 35 size: good.sizeName,
25 count: good.buyNumber, 36 count: good.buyNumber,
@@ -29,8 +29,8 @@ module.exports = { @@ -29,8 +29,8 @@ module.exports = {
29 liveApi: 'http://api.live.yoho.cn/', 29 liveApi: 'http://api.live.yoho.cn/',
30 singleApi: 'http://single.yoho.cn/', 30 singleApi: 'http://single.yoho.cn/',
31 imSocket: 'wss://imsocket.yohobuy.com:443', 31 imSocket: 'wss://imsocket.yohobuy.com:443',
32 - imCs: 'http://im.yohobuy.com/api',  
33 - imServer: 'http://im.yohobuy.com/server' 32 + imCs: 'https://imhttp.yohobuy.com/api',
  33 + imServer: 'https://imhttp.yohobuy.com/server'
34 }, 34 },
35 subDomains: { 35 subDomains: {
36 host: '.m.yohobuy.com', 36 host: '.m.yohobuy.com',