wgt-node-utils 1.2.57 → 1.2.59
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/dist/bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +17 -7
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -151,6 +151,9 @@ class wgtNodeUtils {
|
|
|
151
151
|
let self = this;
|
|
152
152
|
let needReplaceArr = [ 'pro', 'qa', 'dev', 'test', 'development' ];
|
|
153
153
|
if (needReplaceArr.includes(Env)) {
|
|
154
|
+
if(Env === 'qa' || Env === 'test') {
|
|
155
|
+
return `http://test-service.gamebridge.games/image_server`
|
|
156
|
+
}
|
|
154
157
|
return `https://img.enjoy4fun.com`;
|
|
155
158
|
} else {
|
|
156
159
|
const mainDomain = self.getMainDomainByHostname(hostname);
|
|
@@ -316,14 +319,21 @@ class wgtNodeUtils {
|
|
|
316
319
|
}
|
|
317
320
|
// 获取主域名
|
|
318
321
|
getMainDomainByHostname = (hostname) => {
|
|
319
|
-
//
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
322
|
+
// 如果hostname为空,直接返回空字符串
|
|
323
|
+
try {
|
|
324
|
+
// 使用正则表达式匹配主域名
|
|
325
|
+
const match = hostname.match(/(?:.*\.)?([^.]+\.[^.]+)$/);
|
|
326
|
+
// 如果没有匹配到主域名,返回默认的主域名
|
|
327
|
+
if (!match || match.length < 2) {
|
|
328
|
+
return '';
|
|
329
|
+
}
|
|
330
|
+
// 返回匹配到的主域名
|
|
331
|
+
return match[1];
|
|
332
|
+
} catch (e) {
|
|
333
|
+
console.log(e, 'getMainDomainByHostnameError')
|
|
334
|
+
return hostname;
|
|
324
335
|
}
|
|
325
|
-
|
|
326
|
-
return match[1];
|
|
336
|
+
|
|
327
337
|
}
|
|
328
338
|
/***
|
|
329
339
|
* node 端发送日志
|