@jetthai/cuora 1.1.406-dev-1 → 1.1.406-dev-3
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/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/machine/game_info.js +4 -0
- package/src/machine/game_v2_1.js +51 -25
package/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.406-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.407...v1.1.406-dev-3) (2026-01-08)
|
|
6
|
+
|
|
7
|
+
### [1.1.406-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.406-dev-1...v1.1.406-dev-2) (2025-12-22)
|
|
8
|
+
|
|
9
|
+
### [1.1.406-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.406...v1.1.406-dev-1) (2025-12-19)
|
|
10
|
+
|
|
11
|
+
### [1.1.406-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.406-dev-1...v1.1.406-dev-2) (2025-12-22)
|
|
12
|
+
|
|
5
13
|
### [1.1.406-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.406...v1.1.406-dev-1) (2025-12-19)
|
|
6
14
|
|
|
15
|
+
### [1.1.407](https://github.com/jetthai/cuora-module/compare/v1.1.406...v1.1.407) (2025-12-22)
|
|
16
|
+
|
|
7
17
|
### [1.1.406](https://github.com/jetthai/cuora-module/compare/v1.1.405...v1.1.406) (2025-12-16)
|
|
8
18
|
|
|
9
19
|
### [1.1.405](https://github.com/jetthai/cuora-module/compare/v1.1.404...v1.1.405) (2025-12-16)
|
package/package.json
CHANGED
package/src/machine/game_info.js
CHANGED
|
@@ -49,6 +49,10 @@ export default function (request, context) {
|
|
|
49
49
|
services: {
|
|
50
50
|
// 取得遊戲資訊
|
|
51
51
|
fetchGameInfo: async (context, event) => {
|
|
52
|
+
// [防呆] 確保有 gameCode
|
|
53
|
+
if (!gameCode) {
|
|
54
|
+
return { data: {} }
|
|
55
|
+
}
|
|
52
56
|
return await request.send(game.getGameInfo({ appSecret, gameCode }))
|
|
53
57
|
},
|
|
54
58
|
},
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -517,38 +517,60 @@ export default function (request) {
|
|
|
517
517
|
})
|
|
518
518
|
return list.filter((item) => item.downLine.length > 0).slice(0, 6)
|
|
519
519
|
} else if (additionEnable) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
520
|
+
// [防呆] 確保有 categoryId
|
|
521
|
+
const hasCategoryId = !!room?.categoryId
|
|
522
|
+
const param = hasCategoryId ? { categoryId: room.categoryId, index, appSecret } : null
|
|
523
|
+
// [防呆] 確保有 categoryId
|
|
524
|
+
requestChain = event.data.list
|
|
525
|
+
.filter((category) => category && category.id !== undefined && category.id !== null)
|
|
526
|
+
.map((category) =>
|
|
527
|
+
request
|
|
528
|
+
.send(
|
|
529
|
+
api.getListCategory({
|
|
530
|
+
categoryId: category.id,
|
|
531
|
+
index: 0,
|
|
532
|
+
appSecret,
|
|
533
|
+
})
|
|
534
|
+
)
|
|
535
|
+
.then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
|
|
536
|
+
)
|
|
537
|
+
const promises = [...requestChain]
|
|
538
|
+
if (hasCategoryId) {
|
|
539
|
+
promises.push(request.send(api.getListAddition(param)))
|
|
540
|
+
}
|
|
541
|
+
const result = await Promise.all(promises)
|
|
542
|
+
return result.filter((item) => item.downLine?.length > 0).slice(0, 6)
|
|
534
543
|
} else {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
544
|
+
// [防呆] 確保有 categoryId
|
|
545
|
+
requestChain = event.data.list
|
|
546
|
+
.filter((category) => category && category.id !== undefined && category.id !== null)
|
|
547
|
+
.map((category) =>
|
|
548
|
+
request
|
|
549
|
+
.send(
|
|
550
|
+
api.getListCategory({
|
|
551
|
+
categoryId: category.id,
|
|
552
|
+
index: 0,
|
|
553
|
+
appSecret,
|
|
554
|
+
})
|
|
555
|
+
)
|
|
556
|
+
.then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
|
|
557
|
+
)
|
|
546
558
|
const result = await Promise.all([...requestChain])
|
|
547
559
|
return result.filter((item) => item.downLine.length > 0).slice(0, 6)
|
|
548
560
|
}
|
|
549
561
|
},
|
|
550
562
|
getPageContent: async (context, event) => {
|
|
551
563
|
const { room, index, additionEnable, staticData } = context
|
|
564
|
+
// [防呆] 確保有 categoryId
|
|
565
|
+
if (!room?.categoryId) {
|
|
566
|
+
return [
|
|
567
|
+
{
|
|
568
|
+
data: [],
|
|
569
|
+
totalPage: 0,
|
|
570
|
+
timestamp: context.content?.timestamp ?? null,
|
|
571
|
+
},
|
|
572
|
+
]
|
|
573
|
+
}
|
|
552
574
|
if (room.categoryId === GAME_SEARCH) {
|
|
553
575
|
return
|
|
554
576
|
} else if (!request.getToken()) {
|
|
@@ -571,6 +593,10 @@ export default function (request) {
|
|
|
571
593
|
},
|
|
572
594
|
updatePageContent: async (context, event) => {
|
|
573
595
|
const { room, content, index, additionEnable } = context
|
|
596
|
+
// [防呆] 確保有 categoryId
|
|
597
|
+
if (!room?.categoryId) {
|
|
598
|
+
return []
|
|
599
|
+
}
|
|
574
600
|
if (room.categoryId === GAME_SEARCH) {
|
|
575
601
|
return []
|
|
576
602
|
} else if (!request.getToken()) {
|