@jetthai/cuora 1.1.430-dev.0 → 1.1.430

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.
@@ -1,202 +0,0 @@
1
- # /play API providerId=null 問題分析
2
-
3
- ## Kibana 原始日誌
4
-
5
- ```
6
- 2026-04-12 15:43:19.243 [69dbbd97a2e6bc7e5b55e1bfd646452a][78866ac2-f985-4cce-81bd-e39f3fb94d0c][DEBUG][logoutPlayer][http-nio-15050-exec-19] - Request IP:【10.8.19.124】,Request URL:【http://gameprovider-connector-vd.default.svc.cluster.local/game-provider/forward-game】,Request Param:【[FrowardGameRequestBean(uuid=null, providerId=null, gameTypeId=live, gameId=SMG_titaniumLiveGames_MP_Baccarat, uidSite=btkmn08d74kzqpwz2gq@BTK, mappingId=8, isDemo=false, returnUrl=https://www.be-ttk-222.com/play, lang=ko_KR, isMobile=null, ip=211.223.151.97, ipAddress=null, selectedWalletType=ACTIVITY, userTags={=[DEPOSIT_5_9, DEPOSITED_YESTERDAY, AFTERNOON_HIGHLY_ACTIVE, LOYAL_CUSTOMER, FIRST_WITHDRAW_IN_30_DAYS]})]】,Time:【2026-04-12 15:43:19.243】
7
- ```
8
-
9
- ### 關鍵欄位
10
-
11
- | 欄位 | 值 | 說明 |
12
- | -------------------- | ----------------------------------- | ------------------------------------------- |
13
- | `providerId` | `null` | **異常** — 不應為空 |
14
- | `uuid` | `null` | **異常** — 不應為空 |
15
- | `gameId` | `SMG_titaniumLiveGames_MP_Baccarat` | 正常 |
16
- | `gameTypeId` | `live` | 正常 |
17
- | `uidSite` | `btkmn08d74kzqpwz2gq@BTK` | 已登入的 BTK 品牌用戶 |
18
- | `selectedWalletType` | `ACTIVITY` | 用戶選擇了活動錢包 → 經過 ModalSelectWallet |
19
- | `mappingId` | `8` | 正常 |
20
- | `isMobile` | `null` | 可能是桌面端 |
21
- | `lang` | `ko_KR` | 韓語用戶 |
22
-
23
- ---
24
-
25
- ## 資料流追蹤
26
-
27
- ```
28
- 遊戲來源 (活動 API response, provider 欄位缺失)
29
- → 活動元件映射 game.providerId = game.provider → null
30
- → store.enterGame()
31
- → ModalSelectWallet (用戶選擇 ACTIVITY 錢包)
32
- → $gameService.send('ENTER_GAME', { game: { providerId: null, ... } })
33
- → XState setGameInfo → context.game.providerId = null
34
- → flow.idle → flow.connecting
35
- ├─ connectGame service: !null === true → 防呆攔截 → return undefined
36
- │ └─ onDone → setGameURL 收到 undefined → 畫面無遊戲
37
- └─ gameNavigationHandler: 讀取 context.game.providerId = null
38
- └─ URL 序列化: ${null} → 字串 "null"
39
- └─ router.push('/play?...&providerId=null&walletType=ACTIVITY&...')
40
-
41
- 用戶重新整理頁面 (或 beforeRouteUpdate 觸發)
42
- → play.vue 讀取 $route.query.providerId → 字串 "null"
43
- → URL 已帶 walletType=ACTIVITY → 不彈 ModalSelectWallet
44
- → $gameService.send('ENTER_GAME', { game: { providerId: "null", ... } })
45
- → connectGame: !"null" === false → 防呆失效!
46
- → API 請求送出: provider_id="null"
47
- → 後端記錄 Kibana 錯誤
48
- ```
49
-
50
- ---
51
-
52
- ## 根因分析
53
-
54
- ### 根因 #1:活動 API 遊戲資料缺少 `provider` 欄位
55
-
56
- 活動/任務 API 的遊戲資料結構使用 `provider` 欄位(非 `providerId`),前端元件手動映射。
57
- 如果後端回傳的遊戲資料中 `provider` 欄位缺失,`providerId` 就會是 `null`。
58
-
59
- **涉及檔案:**
60
-
61
- | 檔案 | 行號 | 程式碼 |
62
- | ------------------------------------------------ | ---- | ------------------------------------------- |
63
- | `components/modal/MiniGame.vue` | 118 | `game.providerId = game.provider \|\| null` |
64
- | `components/mission/SpecifyBetsActivity.vue` | 74 | `game.providerId = game.provider` |
65
- | `components/mission/SpecifyTurnoverActivity.vue` | 75 | `game.providerId = game.provider` |
66
- | `components/mission/RankingActivity.vue` | 54 | `game.providerId = game.provider` |
67
- | `pages/mission/allgames/_activityNo.vue` | 50 | `game.providerId = game.provider` |
68
-
69
- **嚴重度:高** — 這是 `providerId=null` 的源頭。
70
-
71
- ---
72
-
73
- ### 根因 #2:URL 序列化將 `null` 轉為字串 `"null"`,繞過防呆
74
-
75
- `utils/gameNavigationHandler.js:39-45`:
76
-
77
- ```javascript
78
- const { gameCode, providerId, gameId, gameTypeId, mappingId } = game
79
- const params = { gameCode, providerId, gameId, gameTypeId, mappingId }
80
- const qs = Object.keys(params)
81
- .map((key) => `${key}=${params[key]}`) // ${null} → "null"
82
- .join('&')
83
- router.push(`/play?${qs}`)
84
- ```
85
-
86
- `null` 被 template literal 轉為字串 `"null"`,URL 變成 `/play?...&providerId=null&...`。
87
- 後續從 `$route.query` 讀回時已經是字串 `"null"`,不再是 JavaScript `null`。
88
-
89
- **嚴重度:高** — 這是防呆失效的關鍵轉換點。
90
-
91
- ---
92
-
93
- ### 根因 #3:`connectGame` 防呆無法攔截字串 `"null"`
94
-
95
- `node_modules/@jetthai/cuora/src/machine/game_v2_1.js:641-645`:
96
-
97
- ```javascript
98
- connectGame: async (context, event) => {
99
- const { providerId, gameId } = context.game || {}
100
- if (!providerId || !gameId) return // !"null" === false → 不攔截
101
- // ...
102
- const params = { provider_id: providerId, ... } // provider_id = "null"
103
- }
104
- ```
105
-
106
- | `providerId` 值 | `!providerId` | 防呆結果 |
107
- | -------------------- | ------------- | ------------------ |
108
- | `null` | `true` | 攔截(正確) |
109
- | `undefined` | `true` | 攔截(正確) |
110
- | `""` | `true` | 攔截(正確) |
111
- | `"null"` (字串) | `false` | **不攔截(錯誤)** |
112
- | `"undefined"` (字串) | `false` | **不攔截(錯誤)** |
113
-
114
- **嚴重度:高** — 字串 `"null"` 被當作合法 providerId 送到後端。
115
-
116
- ---
117
-
118
- ### 根因 #4:頁面重整時從 URL 直接使用未驗證的參數
119
-
120
- `pages/play.vue:474-490`:
121
-
122
- ```javascript
123
- if (shouldSendEnterGame && !this.getClickPlayGame) {
124
- const selectWalletEnable = this.getSiteConfig?.selectWalletEnable
125
- if (selectWalletEnable && !walletType) {
126
- // 缺 walletType → 彈 ModalSelectWallet
127
- this.enterGame({ game: { gameCode, providerId, gameId, gameTypeId, mappingId }, ... })
128
- } else {
129
- // URL 已帶 walletType → 直接進入遊戲,不驗證 providerId 是否有效
130
- this.$gameService.send({
131
- type: 'ENTER_GAME',
132
- data: { game: { gameCode, providerId, gameId, gameTypeId, mappingId }, walletType },
133
- })
134
- }
135
- }
136
- ```
137
-
138
- 頁面重整時 URL 已帶 `walletType=ACTIVITY` → 走 `else` 分支 → 直接發送 `ENTER_GAME`。
139
- 此時 `providerId` 為字串 `"null"`,不會經過任何驗證。
140
-
141
- **嚴重度:中** — 頁面重整是觸發 API 帶 `"null"` 的直接路徑。
142
-
143
- ---
144
-
145
- ### 根因 #5(時序問題):`getSiteConfig` 未載入時跳過錢包選擇
146
-
147
- `pages/play.vue:475`:
148
-
149
- ```javascript
150
- const selectWalletEnable = this.getSiteConfig?.selectWalletEnable
151
- ```
152
-
153
- `handlePlayRouteQuery` 在 `beforeMount` 就呼叫(`play.vue:257-258`)。
154
- 如果 `getSiteConfig` API 回應慢(裝置卡頓、網路延遲),`selectWalletEnable` 為 `undefined`:
155
-
156
- - 即使站台 `selectWalletEnable=true`,也走 `else` 分支直接送 ENTER_GAME
157
- - `walletType` 此時為 `undefined`,後端收到 `selectedWalletType=null`
158
-
159
- > 本次 Kibana 日誌 `selectedWalletType=ACTIVITY`,所以此次事件不是這個原因,但仍為潛在風險。
160
-
161
- **嚴重度:低** — 此次非主因,但為獨立的潛在問題。
162
-
163
- ---
164
-
165
- ## 最可能的事件重建
166
-
167
- ```
168
- 1. 用戶從活動/任務頁面點擊遊戲 SMG_titaniumLiveGames_MP_Baccarat
169
- 2. 活動 API 回傳的遊戲資料中 provider 欄位缺失
170
- 3. 活動元件映射:game.providerId = game.provider → null
171
- 4. 觸發 enterGame(),因 selectWalletEnable=true 彈出 ModalSelectWallet
172
- 5. 用戶選擇 ACTIVITY 錢包並確認
173
- 6. $gameService 收到 ENTER_GAME,context.game.providerId = null
174
- 7. 進入 flow.connecting:
175
- - connectGame 防呆攔截 (!null → true) → return undefined
176
- - onDone 觸發,setGameURL 收到 undefined → 畫面無遊戲顯示
177
- - gameNavigationHandler 將 null 序列化為字串寫入 URL
178
- 8. 用戶看到空白/錯誤,重新整理頁面
179
- 9. play.vue 讀取 URL → providerId="null"(字串)
180
- 10. URL 已帶 walletType=ACTIVITY → 直接發送 ENTER_GAME(不彈彈窗)
181
- 11. connectGame 防呆被字串 "null" 繞過
182
- 12. API 請求送出 → 後端記錄 Kibana 錯誤
183
- ```
184
-
185
- ---
186
-
187
- ## 問題總結
188
-
189
- | 層級 | 問題 | 嚴重度 |
190
- | ---------- | -------------------------------------------------------------------- | ------ |
191
- | 資料源 | 活動 API 遊戲的 `provider` 欄位可能缺失,映射後 `providerId=null` | 高 |
192
- | URL 序列化 | `gameNavigationHandler` 將 `null` 轉為字串 `"null"` 寫入 URL,無過濾 | 高 |
193
- | 防呆失效 | `connectGame` 的 `!providerId` 無法攔截字串 `"null"` | 高 |
194
- | 頁面重整 | `play.vue` 重整時從 URL 讀回字串 `"null"` 直接使用,不驗證 | 中 |
195
- | 時序競爭 | `getSiteConfig` 未載入時可能跳過錢包選擇流程 | 低 |
196
-
197
- ## 建議修復方向
198
-
199
- 1. **活動元件**:映射時驗證 `provider` 欄位有效性,缺失時 log 警告或不顯示該遊戲
200
- 2. **gameNavigationHandler**:序列化前過濾 null/undefined,或在 `providerId` 為空時阻止導航
201
- 3. **connectGame 防呆**:加入 `providerId === 'null'` / `providerId === 'undefined'` 字串檢查
202
- 4. **play.vue**:從 URL 讀取參數後驗證必要欄位(`providerId`、`gameId`),無效時導回首頁或顯示錯誤提示
@@ -1 +0,0 @@
1
- Request IP:【10.8.83.20】,Request URL:【http://gameprovider-connector-vd.default.svc.cluster.local/game-provider/forward-game】,Request Param:【[FrowardGameRequestBean(uuid=null, providerId=VD_BGL, gameTypeId=live, gameId=casino, uidSite=btkmn08d74kzqpwz2gq@BTK, mappingId=8, isDemo=false, returnUrl=https://www.be-ttk-222.com/play, lang=ko_KR, isMobile=null, ip=211.223.151.97, ipAddress=null, selectedWalletType=null, userTags={=[DEPOSIT_5_9, DEPOSITED_YESTERDAY, FIRST_WITHDRAW_IN_30_DAYS]})]】,Time:【2026-04-12 15:07:00.195】
@@ -1 +0,0 @@
1
- Request IP:【10.8.3.20】,Request URL:【http://gameprovider-connector-vd.default.svc.cluster.local/game-provider/forward-game】,Request Param:【[FrowardGameRequestBean(uuid=null, providerId=VD_EVO, gameTypeId=live, gameId=XXXtremeLB000001, uidSite=btkmn08d74kzqpwz2gq@BTK, mappingId=8, isDemo=false, returnUrl=https://www.be-ttk-222.com/play, lang=ko_KR, isMobile=null, ip=211.223.151.97, ipAddress=null, selectedWalletType=null, userTags={=[DEPOSIT_5_9]})]】,Time:【2026-04-12 10:07:49.179】