Merge branch 'master' into feature/pressure-test
Showing
5 changed files
with
14 additions
and
9 deletions
@@ -139,9 +139,10 @@ const redpac = { | @@ -139,9 +139,10 @@ const redpac = { | ||
139 | 139 | ||
140 | return res.json(result || {}); | 140 | return res.json(result || {}); |
141 | }).catch(e => { | 141 | }).catch(e => { |
142 | - console.log('error:', e); | 142 | + console.log('MyError:', e); |
143 | sendMessage(0, {}, {message: e.message || 'interface error', stack: e}, 1); | 143 | sendMessage(0, {}, {message: e.message || 'interface error', stack: e}, 1); |
144 | - next(); | 144 | + |
145 | + next(e); | ||
145 | }); | 146 | }); |
146 | }, | 147 | }, |
147 | 148 |
@@ -41,7 +41,7 @@ const sendMessage = (type, tags, fields, isFail) => { | @@ -41,7 +41,7 @@ const sendMessage = (type, tags, fields, isFail) => { | ||
41 | fields | 41 | fields |
42 | }); | 42 | }); |
43 | } catch (e) { | 43 | } catch (e) { |
44 | - console.error(e); | 44 | + logger.error(e); |
45 | } | 45 | } |
46 | }; | 46 | }; |
47 | 47 | ||
@@ -255,16 +255,19 @@ class ActWheelSurfModel extends global.yoho.BaseModel { | @@ -255,16 +255,19 @@ class ActWheelSurfModel extends global.yoho.BaseModel { | ||
255 | } | 255 | } |
256 | }); | 256 | }); |
257 | 257 | ||
258 | - sendMessage(0, {}, {succeedTimes: sendResult.data && sendResult.data.amount || 0}, 0); | 258 | + sendResult = sendResult || {}; |
259 | + sendResult.data = sendResult.data || {}; | ||
260 | + sendMessage(0, {}, {succeedTimes: sendResult.data.amount || 0}, 0); | ||
259 | 261 | ||
260 | - if (sendResult && sendResult.code === 200) { | ||
261 | - if (sendResult.data.isRepReceive === 'N') { | ||
262 | - sendResult.code = 201; // 不能重复领取 | 262 | + if (sendResult.code === 200) { |
263 | + if (!sendResult.data.amount) { | ||
264 | + sendResult.code = 201; // 重复领取 | ||
263 | } else { | 265 | } else { |
264 | getPrize.desc = '恭喜您获得' + sendResult.data.amount + '元红包'; | 266 | getPrize.desc = '恭喜您获得' + sendResult.data.amount + '元红包'; |
265 | } | 267 | } |
266 | } | 268 | } |
267 | } catch (e) { | 269 | } catch (e) { |
270 | + logger.error(e); | ||
268 | sendMessage(0, {}, {message: e.message || 'interface error', stack: e}, 1); | 271 | sendMessage(0, {}, {message: e.message || 'interface error', stack: e}, 1); |
269 | } | 272 | } |
270 | } else if (getPrize.type === 3) { | 273 | } else if (getPrize.type === 3) { |
@@ -284,6 +287,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel { | @@ -284,6 +287,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel { | ||
284 | } | 287 | } |
285 | 288 | ||
286 | } catch (e) { | 289 | } catch (e) { |
290 | + logger.error(e); | ||
287 | sendMessage(1, {}, {message: e.message || 'interface error', stack: e}, 1); | 291 | sendMessage(1, {}, {message: e.message || 'interface error', stack: e}, 1); |
288 | } | 292 | } |
289 | } else if (getPrize.type === 4) { | 293 | } else if (getPrize.type === 4) { |
@@ -9,7 +9,7 @@ const serverError = (err, req, res, next) => { // eslint-disable-line | @@ -9,7 +9,7 @@ const serverError = (err, req, res, next) => { // eslint-disable-line | ||
9 | logger.error(err); | 9 | logger.error(err); |
10 | let code = 500, msg = '服务器错误!'; | 10 | let code = 500, msg = '服务器错误!'; |
11 | 11 | ||
12 | - if (err.code && typeof err.code === 'number' && err.code !== 500 && err.message && !err.message.match(/_ERROR/gi)[0]) { | 12 | + if (err.code && typeof err.code === 'number' && err.code !== 500 && err.message && !/_ERROR/.test(err.message)) { |
13 | code = err.code; | 13 | code = err.code; |
14 | msg = err.message; | 14 | msg = err.message; |
15 | } | 15 | } |
package-lock.json
0 → 100644
This diff could not be displayed because it is too large.
@@ -79,7 +79,7 @@ | @@ -79,7 +79,7 @@ | ||
79 | "uuid": "^3.1.0", | 79 | "uuid": "^3.1.0", |
80 | "whatwg-fetch": "^2.0.3", | 80 | "whatwg-fetch": "^2.0.3", |
81 | "xlsx": "^0.11.16", | 81 | "xlsx": "^0.11.16", |
82 | - "xlsx-style":"^0.8.13", | 82 | + "xlsx-style": "^0.8.13", |
83 | "yoho-md5": "^2.0.0", | 83 | "yoho-md5": "^2.0.0", |
84 | "yoho-node-lib": "^0.6.33", | 84 | "yoho-node-lib": "^0.6.33", |
85 | "yoho-zookeeper": "^1.0.8" | 85 | "yoho-zookeeper": "^1.0.8" |
-
Please register or login to post a comment