Authored by 陈峰

Merge branch 'release/6.7.9' into 'master'

Release/6.7.9 修改error_handler中正则匹配问题



See merge request !69
@@ -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
@@ -244,16 +244,19 @@ class ActWheelSurfModel extends global.yoho.BaseModel { @@ -244,16 +244,19 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
244 } 244 }
245 }); 245 });
246 246
247 - sendMessage(0, {}, {succeedTimes: sendResult.data && sendResult.data.amount || 0}, 0); 247 + sendResult = sendResult || {};
  248 + sendResult.data = sendResult.data || {};
  249 + sendMessage(0, {}, {succeedTimes: sendResult.data.amount || 0}, 0);
248 250
249 - if (sendResult && sendResult.code === 200) {  
250 - if (sendResult.data.isRepReceive === 'N') {  
251 - sendResult.code = 201; // 不能重复领取 251 + if (sendResult.code === 200) {
  252 + if (!sendResult.data.amount) {
  253 + sendResult.code = 201; // 重复领取
252 } else { 254 } else {
253 getPrize.desc = '恭喜您获得' + sendResult.data.amount + '元红包'; 255 getPrize.desc = '恭喜您获得' + sendResult.data.amount + '元红包';
254 } 256 }
255 } 257 }
256 } catch (e) { 258 } catch (e) {
  259 + logger.error(e);
257 sendMessage(0, {}, {message: e.message || 'interface error', stack: e}, 1); 260 sendMessage(0, {}, {message: e.message || 'interface error', stack: e}, 1);
258 } 261 }
259 } else if (getPrize.type === 3) { 262 } else if (getPrize.type === 3) {
@@ -273,6 +276,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel { @@ -273,6 +276,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
273 } 276 }
274 277
275 } catch (e) { 278 } catch (e) {
  279 + logger.error(e);
276 sendMessage(1, {}, {message: e.message || 'interface error', stack: e}, 1); 280 sendMessage(1, {}, {message: e.message || 'interface error', stack: e}, 1);
277 } 281 }
278 } else if (getPrize.type === 4) { 282 } 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 }
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"