Merge branch 'hotfix/presale-cart-message' into 'release/6.8.6'
预售商品在购物车中结算时给予错误提示 See merge request !1686
Showing
2 changed files
with
24 additions
and
7 deletions
@@ -98,12 +98,23 @@ const select = (req, res, next) => { | @@ -98,12 +98,23 @@ const select = (req, res, next) => { | ||
98 | // uid = 20422448; | 98 | // uid = 20422448; |
99 | 99 | ||
100 | return req.ctx(cartModel).selectGood(uid, skuList, shoppingKey, cartType).then(data => { | 100 | return req.ctx(cartModel).selectGood(uid, skuList, shoppingKey, cartType).then(data => { |
101 | - data ? res.json({ | ||
102 | - code: 200, | ||
103 | - data | ||
104 | - }) : res.status(400).json({ | ||
105 | - message: '操作失败' | ||
106 | - }); | 101 | + if (data) { |
102 | + if (data.code !== 500) { | ||
103 | + res.json({ | ||
104 | + code: 200, | ||
105 | + data | ||
106 | + }); | ||
107 | + } else { | ||
108 | + res.status(400).json({ | ||
109 | + code: 500, | ||
110 | + message: data.message || '操作失败!' | ||
111 | + }); | ||
112 | + } | ||
113 | + } else { | ||
114 | + res.status(400).json({ | ||
115 | + message: '操作失败' | ||
116 | + }); | ||
117 | + } | ||
107 | }).catch(next); | 118 | }).catch(next); |
108 | }; | 119 | }; |
109 | 120 |
@@ -48,7 +48,13 @@ class cartModel extends global.yoho.BaseModel { | @@ -48,7 +48,13 @@ class cartModel extends global.yoho.BaseModel { | ||
48 | shopping_key: shoppingKey, | 48 | shopping_key: shoppingKey, |
49 | is_support_mlp: 'Y' | 49 | is_support_mlp: 'Y' |
50 | }}).then((data) => { | 50 | }}).then((data) => { |
51 | - return data.code === 200 ? cartProcess.processData(data, cartType) : void 0; | 51 | + if (data.code === 200) { |
52 | + return cartProcess.processData(data, cartType); | ||
53 | + } else if (data.code === 500) { | ||
54 | + return data; | ||
55 | + } else { | ||
56 | + return void 0; | ||
57 | + } | ||
52 | }); | 58 | }); |
53 | } | 59 | } |
54 | 60 |
-
Please register or login to post a comment