wgt-node-utils 1.2.0 → 1.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgt-node-utils",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "WGT工具类包",
5
5
  "main": "dist/bundle.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -386,7 +386,7 @@ class wgtNodeUtils {
386
386
  console.error(`request: {params: ${JSON.stringify(err.config.params)}, data: ${ err.config.data ? JSON.stringify(err.config.data) : ''}}`);
387
387
  console.error(`response: ${JSON.stringify( this.safeStringify(err.response))}`);
388
388
  feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\nmesssage: ${message}"}`
389
- if (usePageUrl) {
389
+ if (usePageUrl && req) {
390
390
  const pageUrl = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`).href;
391
391
  feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\npageUrl: ${decodeURIComponent(pageUrl)}\\nmesssage: ${message}"}`
392
392
  }
@@ -396,6 +396,10 @@ class wgtNodeUtils {
396
396
  console.error(`============${new Date().toLocaleString()}===========`);
397
397
  console.error(message);
398
398
  feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\nmesssage: ${message}"}`
399
+ if (usePageUrl && req) {
400
+ const pageUrl = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`).href;
401
+ feiShuContent = `{"text":"<b>前端容器node报错</b>\\ncomponent: ${components}\\nenv: ${ENV}\\npageUrl: ${decodeURIComponent(pageUrl)}\\nmesssage: ${message}"}`
402
+ }
399
403
  this.sendFeiShu(feiShuContent, receive_id, useSendFeiShu);
400
404
  }
401
405
  } catch (e) {
@@ -414,7 +418,7 @@ class wgtNodeUtils {
414
418
  }
415
419
  return value;
416
420
  });
417
- }
421
+ }
418
422
  /**
419
423
  * 验证是否为空对像
420
424
  * @param v 对象
@@ -609,11 +613,10 @@ class wgtNodeUtils {
609
613
  let domainArr = hostName.split('.');
610
614
  let domain = domainArr.slice(-2).join('.');
611
615
  let gameDomain = this.gameResourcesMap[domain];
612
-
613
616
  // 当前没有map 中没有存储新的 domain,创建新的map
614
617
  if (!gameDomain) {
615
618
  gameDomain = `https://game.${domain}`;
616
- const isAvailable = await checkDomainAvailability(gameDomain);
619
+ const isAvailable = await this.checkDomainAvailability(`https://game.${domain}`);
617
620
  if (isAvailable) {
618
621
  console.log('gameDomain可用,使用新的域名')
619
622
  this.gameResourcesMap[domain] = gameDomain;
@@ -637,6 +640,7 @@ class wgtNodeUtils {
637
640
  console.log(new Date(), 'gameResourcesMap:存在使用替换新的域名', this.gameResourcesMap, 'gameDomain', gameDomain, 'gameLink', gameLink);
638
641
  return gameLink;
639
642
  } catch (error) {
643
+ console.log(error, 'ReplaceGameResourcesError')
640
644
  gameLink = link;
641
645
  }
642
646
 
@@ -673,7 +677,7 @@ class wgtNodeUtils {
673
677
  if (file && file.length > 0) {
674
678
  return true;
675
679
  }
676
- this.appendLog(`${pageName}[${item}]`, '文件加载失败', 'test', components = '');
680
+ this.appendLog(`文件加载失败:${pageName}[${item}]`, 'test', 'test');
677
681
  return false;
678
682
  });
679
683
  this.filesErrorSendStatus = !fileStatus;