wgt-node-utils 0.0.27 → 0.0.29
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/dist/bundle.js.LICENSE.txt +14 -0
- package/package.json +1 -1
- package/src/index.js +60 -14
- package/webpack.config.js +1 -0
|
@@ -1 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* mime-db
|
|
3
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
4
|
+
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
* mime-types
|
|
10
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
11
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
12
|
+
* MIT Licensed
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -21,7 +21,6 @@ class wgtNodeUtils {
|
|
|
21
21
|
} else {
|
|
22
22
|
console.error('Lark客户端初始化失败:未提供appId或appSecret');
|
|
23
23
|
}
|
|
24
|
-
this.testAxios()
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
// 获取系统信息
|
|
@@ -45,16 +44,6 @@ class wgtNodeUtils {
|
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
testAxios = () => {
|
|
49
|
-
axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
50
|
-
.then(response => {
|
|
51
|
-
console.log('Node.js response:', response.data);
|
|
52
|
-
})
|
|
53
|
-
.catch(error => {
|
|
54
|
-
console.error('Node.js error:', error);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
47
|
/***
|
|
59
48
|
* @headers 设备header 信息
|
|
60
49
|
*
|
|
@@ -180,9 +169,11 @@ class wgtNodeUtils {
|
|
|
180
169
|
* @hostname 网站 hostname
|
|
181
170
|
* @imgDomain 图片地址
|
|
182
171
|
* @creativeId widget creative Id
|
|
172
|
+
* @mobileZoneKeyList 手机端使用zoneKeyList
|
|
173
|
+
* @pcZoneKeyList PC端使用zoneKEyList
|
|
183
174
|
*/
|
|
184
175
|
// TODO 还未开发完成
|
|
185
|
-
async getSiteConfigByHostname(isMobile, url, hostname, imgDomain, creativeId, buildName) {
|
|
176
|
+
async getSiteConfigByHostname(isMobile, url, hostname, imgDomain, creativeId, buildName, mobileZoneKeyList = [], pcZoneKeyList = []) {
|
|
186
177
|
const params = {
|
|
187
178
|
domain: hostname,
|
|
188
179
|
creative_id: creativeId
|
|
@@ -362,11 +353,11 @@ class wgtNodeUtils {
|
|
|
362
353
|
console.error(`${title} [${err.config.method}]: ${err.config.url}`);
|
|
363
354
|
console.error(`request: {params: ${JSON.stringify(err.config.params)}, data: ${JSON.stringify(err.config.data)}}`);
|
|
364
355
|
console.error(`response: ${JSON.stringify(err.response)}`);
|
|
365
|
-
|
|
356
|
+
this.sendFeiShu(`${title} [${err.config.method}]: ${err.config.url}`, ENV, components);
|
|
366
357
|
} else {
|
|
367
358
|
console.error(`============${new Date().toLocaleString()}===========`);
|
|
368
359
|
console.error(`${title} ${err}`);
|
|
369
|
-
|
|
360
|
+
this.sendFeiShu(`${title} ${err}`, ENV, components);
|
|
370
361
|
}
|
|
371
362
|
} catch (e) {
|
|
372
363
|
|
|
@@ -402,6 +393,61 @@ class wgtNodeUtils {
|
|
|
402
393
|
}
|
|
403
394
|
});
|
|
404
395
|
}
|
|
396
|
+
|
|
397
|
+
// 用于渲染游戏详情的数据,清理无用字段
|
|
398
|
+
clearGameData = (game, imgDomain) => {
|
|
399
|
+
// 清除分类中的无用字段
|
|
400
|
+
/**
|
|
401
|
+
* todo 分类背景相关的逻辑需要放到后端接口中处理,待处理后清除这块逻辑
|
|
402
|
+
* 游戏背景图
|
|
403
|
+
* 如果游戏自身设置背景图用自身的
|
|
404
|
+
* 如果没有用类目第一个设置的
|
|
405
|
+
*/
|
|
406
|
+
let categoryBg = {
|
|
407
|
+
bg_left: '',
|
|
408
|
+
bg_right: '',
|
|
409
|
+
bg_bottom: ''
|
|
410
|
+
};
|
|
411
|
+
let categoryBgColor = '';
|
|
412
|
+
const categorys = game.categorys.map((item = {}) => {
|
|
413
|
+
// 抽取第一个存在背景配置的分类
|
|
414
|
+
if (!categoryBg.bg_left && !categoryBg.bg_right && !categoryBg.bg_bottom && item.bg_img) {
|
|
415
|
+
const bgImg = item.bg_img || {};
|
|
416
|
+
categoryBg = {
|
|
417
|
+
bg_left: bgImg.bg_left ? `${imgDomain}/${bgImg.bg_left}` : '',
|
|
418
|
+
bg_right: bgImg.bg_right ? `${imgDomain}/${bgImg.bg_right}` : '',
|
|
419
|
+
bg_bottom: bgImg.bg_bottom ? `${imgDomain}/${bgImg.bg_bottom}` : ''
|
|
420
|
+
}
|
|
421
|
+
categoryBgColor = bgImg.bg_left ? item.theme_color : '';
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
name: item.name,
|
|
425
|
+
path: item.path
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
return {
|
|
429
|
+
game_id: game.game_id,
|
|
430
|
+
game_link: game.game_link,
|
|
431
|
+
game_path: game.game_path,
|
|
432
|
+
game_name: game.game_name,
|
|
433
|
+
description: game.description,
|
|
434
|
+
game_play: game.game_play,
|
|
435
|
+
base_icon: game.base_icon,
|
|
436
|
+
developer: game.developer,
|
|
437
|
+
device_support: game.device_support,
|
|
438
|
+
browser_support: game.browser_support,
|
|
439
|
+
game_type: game.game_type,
|
|
440
|
+
players: game.players,
|
|
441
|
+
loading_video: game.loading_video || game.icon_video,
|
|
442
|
+
loading_video_thumbnail: game.loading_video_thumbnail,
|
|
443
|
+
categorys,
|
|
444
|
+
remind_delay: game.remind_delay || 180,
|
|
445
|
+
// 背景色 如果游戏有设置背景图,则用游戏设置的背景色, 如果没有设置背景图只设置了背景色用自身的背景色,没有背景色则取分类里的背景色
|
|
446
|
+
bg_color: (game.bg_img && game.bg_img.bg_left) ? game.bg_color : game.bg_color ? game.bg_color : categoryBgColor,
|
|
447
|
+
bg_img: (game.bg_img && game.bg_img.bg_left) ? game.bg_img : categoryBg,
|
|
448
|
+
disable_full_screen: !!game.disable_full_screen
|
|
449
|
+
}
|
|
450
|
+
}
|
|
405
451
|
/**
|
|
406
452
|
* 用于渲染类型卡片列表,清理无用字段
|
|
407
453
|
* @param list 清理数组
|