Authored by htoooth

Merge branch 'feature/ufo' of http://git.yoho.cn/fe/yoho-app-web into feature/ufo

@@ -34,6 +34,7 @@ const request = async({url, method, reqParams = {}, context}) => { @@ -34,6 +34,7 @@ const request = async({url, method, reqParams = {}, context}) => {
34 'User-Agent': 'yoho/nodejs' 34 'User-Agent': 'yoho/nodejs'
35 }; 35 };
36 36
  37 + try {
37 if (apiInfo.service) { 38 if (apiInfo.service) {
38 return await serviceApi.get(`${apiInfo.api}${apiInfo.path}`, params, { 39 return await serviceApi.get(`${apiInfo.api}${apiInfo.path}`, params, {
39 cache: cache, 40 cache: cache,
@@ -53,6 +54,12 @@ const request = async({url, method, reqParams = {}, context}) => { @@ -53,6 +54,12 @@ const request = async({url, method, reqParams = {}, context}) => {
53 headers 54 headers
54 }); 55 });
55 } 56 }
  57 + } catch (error) {
  58 + return Promise.reject({
  59 + code: error.code || 500,
  60 + message: error.message || '服务器错误'
  61 + });
  62 + }
56 }; 63 };
57 64
58 export const createApi = context => { 65 export const createApi = context => {
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <span class="unit">码</span> 9 <span class="unit">码</span>
10 </div> 10 </div>
11 <div class="middle"> 11 <div class="middle">
12 - <p class="size-store">¥{{value.goodsInfo.goodPrice}},{{value.goodsInfo.storageNum}}个库存</p> 12 + <p class="size-store">¥{{value.goodsInfo.price}},{{value.goodsInfo.storageNum}}个库存</p>
13 <p class="low-price">当前最低价¥{{value.goodsInfo.leastPrice}}</p> 13 <p class="low-price">当前最低价¥{{value.goodsInfo.leastPrice}}</p>
14 </div> 14 </div>
15 <div class="right"> 15 <div class="right">
@@ -71,11 +71,11 @@ module.exports = async(req, res, next) => { @@ -71,11 +71,11 @@ module.exports = async(req, res, next) => {
71 return res.json({ 71 return res.json({
72 code: 400 72 code: 400
73 }); 73 });
74 - } catch (e) {  
75 - logger.error(e); 74 + } catch (error) {
  75 + logger.error(error);
76 return res.json({ 76 return res.json({
77 - code: 400,  
78 - message: e 77 + code: error.code || 500,
  78 + message: error.message || '服务器错误'
79 }); 79 });
80 } 80 }
81 }; 81 };