wgt-node-utils 1.1.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +10 -9
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -13,6 +13,8 @@ class wgtNodeUtils {
|
|
|
13
13
|
this.client = null;
|
|
14
14
|
// 存储游戏原始链接对象
|
|
15
15
|
this.gameResourcesMap = {};
|
|
16
|
+
// 存储发送飞书告警对象
|
|
17
|
+
this.sendFeiShuMessageMap = {};
|
|
16
18
|
// 是否發送错误信息开关
|
|
17
19
|
this.filesErrorSendStatus = false;
|
|
18
20
|
// 初始化Lark客户端
|
|
@@ -316,11 +318,11 @@ class wgtNodeUtils {
|
|
|
316
318
|
* 飞书发送消息
|
|
317
319
|
* @content 发送信息 json
|
|
318
320
|
* @receive_id 飞书发送群ID
|
|
319
|
-
* @
|
|
321
|
+
* @useSend 开启测试
|
|
320
322
|
*/
|
|
321
|
-
sendFeiShu = (feiShuContent,
|
|
323
|
+
sendFeiShu = (feiShuContent, receive_id, useSendFeiShu = false) => {
|
|
322
324
|
|
|
323
|
-
if (
|
|
325
|
+
if (!useSendFeiShu) {
|
|
324
326
|
return;
|
|
325
327
|
}
|
|
326
328
|
// 发送消息
|
|
@@ -370,7 +372,7 @@ class wgtNodeUtils {
|
|
|
370
372
|
usePageUrl = false,
|
|
371
373
|
req = null,
|
|
372
374
|
receive_id = 'oc_aba13955509035daa7a799f30b1b3341',
|
|
373
|
-
|
|
375
|
+
useSendFeiShu = false
|
|
374
376
|
} = options;
|
|
375
377
|
try {
|
|
376
378
|
let feiShuContent = ''
|
|
@@ -384,18 +386,17 @@ class wgtNodeUtils {
|
|
|
384
386
|
console.error(`request: {params: ${JSON.stringify(err.config.params)}, data: ${ err.config.data ? JSON.stringify(err.config.data) : ''}}`);
|
|
385
387
|
console.error(`response: ${JSON.stringify( this.safeStringify(err.response))}`);
|
|
386
388
|
feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\nmesssage: ${message}"}`
|
|
387
|
-
|
|
388
|
-
if (usePageUrl && req) {
|
|
389
|
+
if (usePageUrl) {
|
|
389
390
|
const pageUrl = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`).href;
|
|
390
391
|
feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\npageUrl: ${decodeURIComponent(pageUrl)}\\nmesssage: ${message}"}`
|
|
391
392
|
}
|
|
392
|
-
this.sendFeiShu(feiShuContent,
|
|
393
|
+
this.sendFeiShu(feiShuContent, receive_id, useSendFeiShu);
|
|
393
394
|
|
|
394
395
|
} else {
|
|
395
396
|
console.error(`============${new Date().toLocaleString()}===========`);
|
|
396
397
|
console.error(message);
|
|
397
398
|
feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\nmesssage: ${message}"}`
|
|
398
|
-
this.sendFeiShu(feiShuContent,
|
|
399
|
+
this.sendFeiShu(feiShuContent, receive_id, useSendFeiShu);
|
|
399
400
|
}
|
|
400
401
|
} catch (e) {
|
|
401
402
|
console.log(e, '=============catch==============')
|
|
@@ -698,7 +699,7 @@ class wgtNodeUtils {
|
|
|
698
699
|
let self = this
|
|
699
700
|
try {
|
|
700
701
|
const res = await axios.get(url);
|
|
701
|
-
const properties = res.data
|
|
702
|
+
const properties = res.data && res.data.data && res.data.data.properties || {};
|
|
702
703
|
|
|
703
704
|
// 默认值
|
|
704
705
|
const contactEmail = properties.contact || "gamebridgenoreply@gmail.com";
|