@jetthai/cuora 1.1.406-dev-2 → 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 +8 -0
- package/package.json +1 -1
- package/src/machine/game_info.js +4 -0
- package/src/machine/game_v2_1.js +48 -32
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +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
|
+
|
|
5
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)
|
|
6
12
|
|
|
7
13
|
### [1.1.406-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.406...v1.1.406-dev-1) (2025-12-19)
|
|
8
14
|
|
|
15
|
+
### [1.1.407](https://github.com/jetthai/cuora-module/compare/v1.1.406...v1.1.407) (2025-12-22)
|
|
16
|
+
|
|
9
17
|
### [1.1.406](https://github.com/jetthai/cuora-module/compare/v1.1.405...v1.1.406) (2025-12-16)
|
|
10
18
|
|
|
11
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,44 +517,61 @@ 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
|
|
552
|
-
//
|
|
564
|
+
// [防呆] 確保有 categoryId
|
|
553
565
|
if (!room?.categoryId) {
|
|
554
|
-
|
|
555
|
-
|
|
566
|
+
return [
|
|
567
|
+
{
|
|
568
|
+
data: [],
|
|
569
|
+
totalPage: 0,
|
|
570
|
+
timestamp: context.content?.timestamp ?? null,
|
|
571
|
+
},
|
|
572
|
+
]
|
|
556
573
|
}
|
|
557
|
-
if (room
|
|
574
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
558
575
|
return
|
|
559
576
|
} else if (!request.getToken()) {
|
|
560
577
|
const list = staticData.find((data) => data.category == room.categoryId)?.info || []
|
|
@@ -576,12 +593,11 @@ export default function (request) {
|
|
|
576
593
|
},
|
|
577
594
|
updatePageContent: async (context, event) => {
|
|
578
595
|
const { room, content, index, additionEnable } = context
|
|
579
|
-
//
|
|
596
|
+
// [防呆] 確保有 categoryId
|
|
580
597
|
if (!room?.categoryId) {
|
|
581
|
-
console.error('No room categoryId found for updating content')
|
|
582
598
|
return []
|
|
583
599
|
}
|
|
584
|
-
if (room
|
|
600
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
585
601
|
return []
|
|
586
602
|
} else if (!request.getToken()) {
|
|
587
603
|
return []
|