@jetthai/cuora 1.1.472-dev.1 → 1.1.472
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/.claude/commands/sync-ai-prompts.md +1 -88
- package/.claude/settings.local.json +1 -3
- package/.github/copilot-instructions.md +57 -64
- package/.husky/post-checkout +3 -3
- package/.husky/pre-push +1 -1
- package/.prettierignore +1 -2
- package/AGENTS.md +57 -64
- package/AI_PROMPT_SOURCE.md +57 -64
- package/CHANGELOG.md +5 -202
- package/CLAUDE.md +57 -64
- package/GEMINI.md +57 -64
- package/README.md +12 -11
- package/package.json +1 -1
- package/scripts/auto-version.js +0 -1
- package/scripts/branch-auto-npm-publish.js +2 -9
- package/src/api/account.js +1 -0
- package/src/api/activity.js +38 -2
- package/src/api/auth.js +31 -0
- package/src/api/game.js +10 -0
- package/src/api/payment.js +52 -1
- package/src/api/user.js +16 -0
- package/src/index.js +2 -2
- package/src/machine/activity/activity.js +209 -0
- package/src/machine/activity/activity_cash.js +23 -62
- package/src/machine/activity/diamond_shop_activity_cash.js +1 -0
- package/src/machine/activity/diamond_shop_activity_fc.js +196 -0
- package/src/machine/activity/diamond_shop_activity_vn.js +178 -0
- package/src/machine/activity/fafafa_activity.js +10 -0
- package/src/machine/activity/index.js +12 -0
- package/src/machine/activity/invite_friends_activity.js +114 -0
- package/src/machine/activity/mini_game_activity.js +68 -0
- package/src/machine/activity/return_bonus_activity.js +153 -0
- package/src/machine/auth.js +59 -0
- package/src/machine/auth_otp_v2.js +177 -0
- package/src/machine/auth_otp_v3.js +3 -0
- package/src/machine/bank_binding_amb.js +146 -0
- package/src/machine/bonus.js +76 -0
- package/src/machine/common.js +55 -0
- package/src/machine/deposit/amb.js +93 -0
- package/src/machine/deposit/crypto_bank.js +330 -0
- package/src/machine/deposit/crypto_qrcode.js +148 -0
- package/src/machine/deposit/crypto_way.js +252 -0
- package/src/machine/deposit/deposit_fc.js +272 -0
- package/src/machine/deposit/direct.js +310 -0
- package/src/machine/deposit/float.js +375 -0
- package/src/machine/deposit/index.js +28 -0
- package/src/machine/deposit/krway.js +151 -0
- package/src/machine/deposit/loadcard_vn.js +351 -0
- package/src/machine/deposit/manual_cash.js +8 -0
- package/src/machine/deposit/manual_vn.js +458 -0
- package/src/machine/deposit/qrcode_v2.js +338 -0
- package/src/machine/deposit/usdt.js +144 -0
- package/src/machine/deposit/virtual_bank_vn.js +269 -0
- package/src/machine/deposit/vpay.js +368 -0
- package/src/machine/game_hot_new.js +79 -0
- package/src/machine/game_info.js +12 -1
- package/src/machine/game_replay.js +46 -0
- package/src/machine/game_search_v2.js +401 -0
- package/src/machine/game_v2_1.js +89 -1
- package/src/machine/honor_board.js +132 -0
- package/src/machine/honor_board_cash.js +18 -15
- package/src/machine/inbox.js +12 -0
- package/src/machine/index.js +32 -0
- package/src/machine/merge.js +57 -0
- package/src/machine/payment_data.js +86 -0
- package/src/machine/promotions.js +170 -0
- package/src/machine/reward.js +255 -0
- package/src/machine/reward_cash.js +39 -0
- package/src/machine/reward_fc.js +98 -0
- package/src/machine/side.js +154 -0
- package/src/machine/side_v2.js +211 -0
- package/src/machine/user_reset_password.js +13 -0
- package/src/machine/user_sign_up.js +0 -3
- package/src/machine/vip_table.js +57 -0
- package/src/machine/websocket.js +4 -0
- package/src/machine/welcome.js +110 -0
- package/src/machine/withdraw/index.js +6 -0
- package/src/machine/withdraw/withdraw_crypto_cash.js +327 -0
- package/src/machine/withdraw/withdraw_krway.js +223 -0
- package/src/machine/withdraw/withdraw_manual.js +536 -0
- package/src/request/request.js +29 -1
- package/src/util/constant.js +1 -0
- package/src/util/index.js +4 -1
- package/src/util/math.js +4 -0
package/src/machine/game_info.js
CHANGED
|
@@ -24,7 +24,13 @@ export default function (request, context) {
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
-
idle: {
|
|
27
|
+
idle: {
|
|
28
|
+
// on: {
|
|
29
|
+
// SET_GAME_CODE: {
|
|
30
|
+
// actions: 'setGameCode',
|
|
31
|
+
// },
|
|
32
|
+
// },
|
|
33
|
+
},
|
|
28
34
|
},
|
|
29
35
|
},
|
|
30
36
|
{
|
|
@@ -34,6 +40,11 @@ export default function (request, context) {
|
|
|
34
40
|
gameInfo: event.data.data,
|
|
35
41
|
}
|
|
36
42
|
}),
|
|
43
|
+
// setGameCode: assign((context, event) => {
|
|
44
|
+
// return {
|
|
45
|
+
// gameCode: event.data.data,
|
|
46
|
+
// }
|
|
47
|
+
// }),
|
|
37
48
|
},
|
|
38
49
|
services: {
|
|
39
50
|
// 取得遊戲資訊
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import game from '../api/game.js'
|
|
3
|
+
|
|
4
|
+
export default function (request, context) {
|
|
5
|
+
const { appSecret } = request.config
|
|
6
|
+
const { providerId, seqNo, lang } = context
|
|
7
|
+
return createMachine(
|
|
8
|
+
{
|
|
9
|
+
id: 'game_replay',
|
|
10
|
+
initial: 'fetching',
|
|
11
|
+
context: {
|
|
12
|
+
gameReplayInfo: {},
|
|
13
|
+
},
|
|
14
|
+
states: {
|
|
15
|
+
fetching: {
|
|
16
|
+
invoke: {
|
|
17
|
+
src: 'fetchGameReplayInfo',
|
|
18
|
+
onDone: {
|
|
19
|
+
target: 'idle',
|
|
20
|
+
actions: 'setGameReplayInfo',
|
|
21
|
+
},
|
|
22
|
+
onError: {
|
|
23
|
+
target: 'idle',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
idle: {},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
actions: {
|
|
32
|
+
setGameReplayInfo: assign((context, event) => {
|
|
33
|
+
return {
|
|
34
|
+
gameReplayInfo: event.data.data,
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
services: {
|
|
39
|
+
// 取得遊戲重播資訊
|
|
40
|
+
fetchGameReplayInfo: async (context, event) => {
|
|
41
|
+
return await request.send(game.getGameReplayInfo({ providerId, seqNo, lang, appSecret }))
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { createMachine, assign, send } from 'xstate'
|
|
2
|
+
import game from '../api/game.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
return createMachine(
|
|
6
|
+
{
|
|
7
|
+
id: 'game_search_v2',
|
|
8
|
+
initial: 'init',
|
|
9
|
+
context: {
|
|
10
|
+
keyword: '',
|
|
11
|
+
tagId: null,
|
|
12
|
+
mainTagList: [],
|
|
13
|
+
tagList: [],
|
|
14
|
+
gameList: [],
|
|
15
|
+
recentlySearch: [],
|
|
16
|
+
recentlyGame: [],
|
|
17
|
+
youMayLike: [],
|
|
18
|
+
// 以下變數為數據分析用
|
|
19
|
+
selectedType: null,
|
|
20
|
+
tagIndex: null,
|
|
21
|
+
click: null,
|
|
22
|
+
clickDefault: null,
|
|
23
|
+
traceId: null,
|
|
24
|
+
isYouMayLike: false,
|
|
25
|
+
isRecentlyGame: false,
|
|
26
|
+
isRecentlySearch: false,
|
|
27
|
+
gameCode: null,
|
|
28
|
+
lang: 'en-US',
|
|
29
|
+
},
|
|
30
|
+
states: {
|
|
31
|
+
init: {
|
|
32
|
+
on: {
|
|
33
|
+
INIT: {
|
|
34
|
+
target: 'preset',
|
|
35
|
+
actions: ['setLang'],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
preset: {
|
|
40
|
+
invoke: {
|
|
41
|
+
src: 'fetchTags',
|
|
42
|
+
onDone: {
|
|
43
|
+
target: 'loading',
|
|
44
|
+
actions: 'setMainTagList',
|
|
45
|
+
},
|
|
46
|
+
onError: {
|
|
47
|
+
target: 'fail',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
loading: {
|
|
52
|
+
invoke: {
|
|
53
|
+
src: 'fetchInitialData',
|
|
54
|
+
onDone: {
|
|
55
|
+
target: 'idle',
|
|
56
|
+
actions: 'setInitialData',
|
|
57
|
+
},
|
|
58
|
+
onError: {
|
|
59
|
+
target: '#game_search_v2.fail',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
idle: {
|
|
64
|
+
on: {
|
|
65
|
+
SET_MAIN_TAG_ID: {
|
|
66
|
+
target: 'setGameList',
|
|
67
|
+
actions: ['setMainTagId', 'setTraceData'],
|
|
68
|
+
},
|
|
69
|
+
PLAY_GAME: {
|
|
70
|
+
target: 'sendingTrace',
|
|
71
|
+
actions: 'setGameCode',
|
|
72
|
+
},
|
|
73
|
+
START_SEARCH: {
|
|
74
|
+
target: 'searching',
|
|
75
|
+
actions: 'clearKeywords',
|
|
76
|
+
},
|
|
77
|
+
CLEAR_MAIN_TAG: {
|
|
78
|
+
actions: 'clearMainTag',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
setGameList: {
|
|
83
|
+
always: [
|
|
84
|
+
{
|
|
85
|
+
target: 'idle',
|
|
86
|
+
actions: 'setGames',
|
|
87
|
+
cond: 'isRecentlyYouMayLike',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
target: 'fetchGameList',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
fetchGameList: {
|
|
95
|
+
invoke: {
|
|
96
|
+
src: 'fetchGames',
|
|
97
|
+
onDone: {
|
|
98
|
+
target: 'idle',
|
|
99
|
+
actions: 'setGames',
|
|
100
|
+
},
|
|
101
|
+
onError: {
|
|
102
|
+
target: '#game_search_v2.fail',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
searching: {
|
|
107
|
+
initial: 'searchIdle',
|
|
108
|
+
states: {
|
|
109
|
+
searchIdle: {
|
|
110
|
+
on: {
|
|
111
|
+
SET_TAG_ID: {
|
|
112
|
+
target: '#game_search_v2.fetchGameList',
|
|
113
|
+
actions: ['setTagId', 'setTraceData'],
|
|
114
|
+
},
|
|
115
|
+
PRESS_ENTER: [
|
|
116
|
+
{
|
|
117
|
+
actions: send((context, event) => ({
|
|
118
|
+
type: 'SET_TAG_ID',
|
|
119
|
+
data: {
|
|
120
|
+
tagId: context.tagList[0]?.id,
|
|
121
|
+
traceData: {
|
|
122
|
+
isYouMayLike: false,
|
|
123
|
+
isRecentlyGame: false,
|
|
124
|
+
isRecentlySearch: false,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
})),
|
|
128
|
+
cond: 'hasTagList',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
target: '#game_search_v2.sendingTrace',
|
|
132
|
+
actions: 'clearExceptKeyword',
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
SET_KEYWORD: {
|
|
136
|
+
target: 'debouncing',
|
|
137
|
+
actions: ['setKeyword', 'setLang'],
|
|
138
|
+
},
|
|
139
|
+
STOP_SEARCH: {
|
|
140
|
+
target: '#game_search_v2.idle',
|
|
141
|
+
actions: 'clearKeywords',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
debouncing: {
|
|
146
|
+
on: {
|
|
147
|
+
SET_KEYWORD: {
|
|
148
|
+
target: 'debouncing',
|
|
149
|
+
actions: ['setKeyword', 'setLang'],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
after: {
|
|
153
|
+
500: {
|
|
154
|
+
target: 'fetching',
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
fetching: {
|
|
159
|
+
invoke: {
|
|
160
|
+
src: 'fetchTags',
|
|
161
|
+
onDone: {
|
|
162
|
+
target: 'searchIdle',
|
|
163
|
+
actions: 'setTagList',
|
|
164
|
+
},
|
|
165
|
+
onError: {
|
|
166
|
+
target: '#game_search_v2.fail',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
sendingTrace: {
|
|
173
|
+
invoke: {
|
|
174
|
+
src: 'sendTrace',
|
|
175
|
+
onDone: {
|
|
176
|
+
target: 'idle',
|
|
177
|
+
},
|
|
178
|
+
onError: {
|
|
179
|
+
target: 'fail',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
fail: {},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
actions: {
|
|
188
|
+
setMainTagList: assign((context, event) => {
|
|
189
|
+
return {
|
|
190
|
+
mainTagList: event.data,
|
|
191
|
+
}
|
|
192
|
+
}),
|
|
193
|
+
setInitialData: assign((context, event) => {
|
|
194
|
+
const { recentlySearch = [], recentlyGame = [], youMayLike = [] } = event.data
|
|
195
|
+
let tagId = null
|
|
196
|
+
let gameList = []
|
|
197
|
+
if (recentlyGame?.length > 0) {
|
|
198
|
+
gameList = recentlyGame
|
|
199
|
+
} else if (youMayLike?.length > 0) {
|
|
200
|
+
gameList = youMayLike
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
recentlySearch: recentlySearch.filter((item) => item.id && item.i18n),
|
|
204
|
+
recentlyGame,
|
|
205
|
+
youMayLike,
|
|
206
|
+
gameList,
|
|
207
|
+
tagId,
|
|
208
|
+
}
|
|
209
|
+
}),
|
|
210
|
+
setMainTagId: assign((context, event) => {
|
|
211
|
+
const { tagId } = event.data
|
|
212
|
+
const { mainTagList } = context
|
|
213
|
+
const tagIndex = mainTagList.findIndex((tag) => tag.id === tagId)
|
|
214
|
+
return {
|
|
215
|
+
keyword: '',
|
|
216
|
+
tagId,
|
|
217
|
+
tagIndex,
|
|
218
|
+
click: 1,
|
|
219
|
+
clickDefault: null,
|
|
220
|
+
}
|
|
221
|
+
}),
|
|
222
|
+
clearMainTag: assign((context, event) => {
|
|
223
|
+
return {
|
|
224
|
+
tagId: null,
|
|
225
|
+
}
|
|
226
|
+
}),
|
|
227
|
+
setTagId: assign((context, event) => {
|
|
228
|
+
const { tagId, clickTagType } = event.data
|
|
229
|
+
const { mainTagList, tagList, recentlySearch } = context
|
|
230
|
+
if (clickTagType === 'RECENTLY SEARCH') {
|
|
231
|
+
const tagIndex = recentlySearch.findIndex((tag) => tag.id === tagId)
|
|
232
|
+
return {
|
|
233
|
+
tagId,
|
|
234
|
+
tagIndex,
|
|
235
|
+
click: 1,
|
|
236
|
+
clickDefault: null,
|
|
237
|
+
}
|
|
238
|
+
} else if (clickTagType === 'POPULAR KEYWORDS' || tagList.length <= 0) {
|
|
239
|
+
const tagIndex = mainTagList.findIndex((tag) => tag.id === tagId)
|
|
240
|
+
return {
|
|
241
|
+
tagId,
|
|
242
|
+
tagIndex,
|
|
243
|
+
click: null,
|
|
244
|
+
clickDefault: 1,
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
const tagIndex = tagList.findIndex((tag) => tag.id === tagId)
|
|
248
|
+
return {
|
|
249
|
+
tagId,
|
|
250
|
+
tagIndex,
|
|
251
|
+
click: 1,
|
|
252
|
+
clickDefault: null,
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}),
|
|
256
|
+
setGames: assign((context, event) => {
|
|
257
|
+
if (event?.data) {
|
|
258
|
+
const { traceId, result } = event.data
|
|
259
|
+
return {
|
|
260
|
+
traceId,
|
|
261
|
+
gameList: result,
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
const { tagId, recentlyGame, youMayLike } = context
|
|
265
|
+
let gameList = []
|
|
266
|
+
if (tagId === 'Recently') {
|
|
267
|
+
gameList = recentlyGame
|
|
268
|
+
} else if (tagId === 'You may like') {
|
|
269
|
+
gameList = youMayLike
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
traceId: null,
|
|
273
|
+
gameList,
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}),
|
|
277
|
+
setTraceData: assign((context, event) => {
|
|
278
|
+
const { isYouMayLike, isRecentlyGame, isRecentlySearch } = event.data?.traceData
|
|
279
|
+
return {
|
|
280
|
+
isYouMayLike,
|
|
281
|
+
isRecentlyGame,
|
|
282
|
+
isRecentlySearch,
|
|
283
|
+
}
|
|
284
|
+
}),
|
|
285
|
+
setKeyword: assign((context, event) => {
|
|
286
|
+
return {
|
|
287
|
+
keyword: event.data.keyword,
|
|
288
|
+
}
|
|
289
|
+
}),
|
|
290
|
+
setLang: assign((context, event) => {
|
|
291
|
+
return {
|
|
292
|
+
lang: event.data.lang,
|
|
293
|
+
}
|
|
294
|
+
}),
|
|
295
|
+
clearKeywords: assign((context, event) => {
|
|
296
|
+
return {
|
|
297
|
+
keyword: '',
|
|
298
|
+
}
|
|
299
|
+
}),
|
|
300
|
+
setTagList: assign((context, event) => {
|
|
301
|
+
return {
|
|
302
|
+
tagList: event.data,
|
|
303
|
+
}
|
|
304
|
+
}),
|
|
305
|
+
setGameCode: assign((context, event) => {
|
|
306
|
+
const { gameList } = context
|
|
307
|
+
const gameCode = event.data
|
|
308
|
+
const gameCodeIndex = gameList.findIndex((game) => game?.gameCode === gameCode)
|
|
309
|
+
return {
|
|
310
|
+
gameCode,
|
|
311
|
+
gameCodeIndex,
|
|
312
|
+
}
|
|
313
|
+
}),
|
|
314
|
+
clearExceptKeyword: assign((context, event) => {
|
|
315
|
+
return {
|
|
316
|
+
gameList: [],
|
|
317
|
+
traceId: null,
|
|
318
|
+
tagId: null,
|
|
319
|
+
tagIndex: null,
|
|
320
|
+
gameCode: null,
|
|
321
|
+
gameCodeIndex: null,
|
|
322
|
+
isYouMayLike: false,
|
|
323
|
+
isRecentlyGame: false,
|
|
324
|
+
isRecentlySearch: false,
|
|
325
|
+
query: context.keyword,
|
|
326
|
+
click: null,
|
|
327
|
+
clickDefault: null,
|
|
328
|
+
}
|
|
329
|
+
}),
|
|
330
|
+
},
|
|
331
|
+
guards: {
|
|
332
|
+
isRecentlyYouMayLike: (context, event) => {
|
|
333
|
+
const { tagId } = context
|
|
334
|
+
return tagId === 'Recently' || tagId === 'You may like'
|
|
335
|
+
},
|
|
336
|
+
hasTagList: (context, event) => {
|
|
337
|
+
const { tagList } = context
|
|
338
|
+
return tagList?.length > 0
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
services: {
|
|
342
|
+
fetchTags: async (context, event) => {
|
|
343
|
+
const { keyword, lang } = context
|
|
344
|
+
const { result } = await request.send(game.getGameTags({ q: keyword, lang }))
|
|
345
|
+
return result
|
|
346
|
+
},
|
|
347
|
+
fetchInitialData: async (context, event) => {
|
|
348
|
+
const data = await request.send(game.getGameSearchHome())
|
|
349
|
+
return data
|
|
350
|
+
},
|
|
351
|
+
fetchGames: async (context, event) => {
|
|
352
|
+
const { tagId, tagIndex, keyword, click, clickDefault } = context
|
|
353
|
+
const { traceId, result } = await request.send(
|
|
354
|
+
game.getGameSearchList({
|
|
355
|
+
id: tagId,
|
|
356
|
+
index: tagIndex,
|
|
357
|
+
q: keyword,
|
|
358
|
+
click,
|
|
359
|
+
clickDefault,
|
|
360
|
+
})
|
|
361
|
+
)
|
|
362
|
+
return { traceId, result }
|
|
363
|
+
},
|
|
364
|
+
sendTrace: async (context, event) => {
|
|
365
|
+
const {
|
|
366
|
+
traceId,
|
|
367
|
+
tagId,
|
|
368
|
+
tagIndex,
|
|
369
|
+
gameCode,
|
|
370
|
+
gameCodeIndex,
|
|
371
|
+
keyword: query,
|
|
372
|
+
click,
|
|
373
|
+
clickDefault,
|
|
374
|
+
isYouMayLike,
|
|
375
|
+
isRecentlyGame,
|
|
376
|
+
isRecentlySearch,
|
|
377
|
+
} = context
|
|
378
|
+
let id = tagId
|
|
379
|
+
if (tagId === 'Recently' || tagId === 'You may like') {
|
|
380
|
+
id = null
|
|
381
|
+
}
|
|
382
|
+
return await request.send(
|
|
383
|
+
game.setGameSearchTrace({
|
|
384
|
+
traceId,
|
|
385
|
+
tagId: id,
|
|
386
|
+
tagIndex,
|
|
387
|
+
gameCode,
|
|
388
|
+
gameCodeIndex,
|
|
389
|
+
query,
|
|
390
|
+
click,
|
|
391
|
+
clickDefault,
|
|
392
|
+
isYouMayLike,
|
|
393
|
+
isRecentlyGame,
|
|
394
|
+
isRecentlySearch,
|
|
395
|
+
})
|
|
396
|
+
)
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
}
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -12,6 +12,7 @@ export default function (request) {
|
|
|
12
12
|
type: 'parallel',
|
|
13
13
|
context: {
|
|
14
14
|
base: '/',
|
|
15
|
+
batch: null,
|
|
15
16
|
loadable: false,
|
|
16
17
|
isLastPage: false,
|
|
17
18
|
pageLoading: true,
|
|
@@ -64,6 +65,9 @@ export default function (request) {
|
|
|
64
65
|
SET_STATIC_DATA: {
|
|
65
66
|
actions: 'setStaticData',
|
|
66
67
|
},
|
|
68
|
+
SET_ADDITION_ENABLE: {
|
|
69
|
+
actions: 'setAdditionEnable',
|
|
70
|
+
},
|
|
67
71
|
LOAD: {
|
|
68
72
|
target: 'routing',
|
|
69
73
|
actions: 'setLoadable',
|
|
@@ -77,6 +81,9 @@ export default function (request) {
|
|
|
77
81
|
cond: 'isDifferentRoom',
|
|
78
82
|
actions: ['setRoom', 'resetContent'],
|
|
79
83
|
},
|
|
84
|
+
BATCH: {
|
|
85
|
+
target: 'batchFetching',
|
|
86
|
+
},
|
|
80
87
|
ENTER_GAME: {
|
|
81
88
|
target: 'connecting',
|
|
82
89
|
actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
|
|
@@ -94,6 +101,18 @@ export default function (request) {
|
|
|
94
101
|
},
|
|
95
102
|
},
|
|
96
103
|
},
|
|
104
|
+
batchFetching: {
|
|
105
|
+
invoke: {
|
|
106
|
+
src: 'batchFetch',
|
|
107
|
+
onDone: {
|
|
108
|
+
target: 'idle',
|
|
109
|
+
actions: 'setBatch',
|
|
110
|
+
},
|
|
111
|
+
onError: {
|
|
112
|
+
target: 'idle',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
97
116
|
loading: {
|
|
98
117
|
entry: 'increaseIndex',
|
|
99
118
|
invoke: {
|
|
@@ -211,7 +230,7 @@ export default function (request) {
|
|
|
211
230
|
actions: ['setSwitch', 'setLang', 'setEntry', 'setWalletType'],
|
|
212
231
|
},
|
|
213
232
|
ENTER_GAME_PAUSE: {
|
|
214
|
-
actions: ['setIsPlaying', 'resetContent'],
|
|
233
|
+
actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
|
|
215
234
|
},
|
|
216
235
|
ENTER_GAME: {
|
|
217
236
|
target: 'connecting',
|
|
@@ -325,6 +344,11 @@ export default function (request) {
|
|
|
325
344
|
staticData: event.data,
|
|
326
345
|
}
|
|
327
346
|
}),
|
|
347
|
+
setAdditionEnable: assign((context, event) => {
|
|
348
|
+
return {
|
|
349
|
+
additionEnable: event.data,
|
|
350
|
+
}
|
|
351
|
+
}),
|
|
328
352
|
setLoadable: assign((context, event) => {
|
|
329
353
|
return {
|
|
330
354
|
loadable: event.data,
|
|
@@ -342,6 +366,11 @@ export default function (request) {
|
|
|
342
366
|
room: event.data,
|
|
343
367
|
}
|
|
344
368
|
}),
|
|
369
|
+
setBatch: assign((context, event) => {
|
|
370
|
+
return {
|
|
371
|
+
batch: event.data,
|
|
372
|
+
}
|
|
373
|
+
}),
|
|
345
374
|
resetContent: assign((context, event) => {
|
|
346
375
|
return {
|
|
347
376
|
loadable: false,
|
|
@@ -481,6 +510,65 @@ export default function (request) {
|
|
|
481
510
|
},
|
|
482
511
|
},
|
|
483
512
|
services: {
|
|
513
|
+
batchFetch: async (context, event) => {
|
|
514
|
+
const { room, index, additionEnable, staticData } = context
|
|
515
|
+
let requestChain = null
|
|
516
|
+
if (!request.getToken()) {
|
|
517
|
+
// 如果沒 token ,id 列表去 static 找
|
|
518
|
+
const list = event.data.list.map((targetCategory, b) => {
|
|
519
|
+
return {
|
|
520
|
+
id: targetCategory.id,
|
|
521
|
+
i18n: targetCategory.i18n,
|
|
522
|
+
downLine: staticData
|
|
523
|
+
.find((item) => item.category === targetCategory.id)
|
|
524
|
+
.info.filter((item) => item.isGame)
|
|
525
|
+
.slice(0, 20),
|
|
526
|
+
}
|
|
527
|
+
})
|
|
528
|
+
return list.filter((item) => item.downLine.length > 0).slice(0, 6)
|
|
529
|
+
} else if (additionEnable) {
|
|
530
|
+
// [防呆] 確保有 categoryId
|
|
531
|
+
const hasCategoryId = !!room?.categoryId
|
|
532
|
+
const param = hasCategoryId ? { categoryId: room.categoryId, index, appSecret } : null
|
|
533
|
+
// [防呆] 確保有 categoryId
|
|
534
|
+
requestChain = event.data.list
|
|
535
|
+
.filter((category) => category?.id != null)
|
|
536
|
+
.map((category) =>
|
|
537
|
+
request
|
|
538
|
+
.send(
|
|
539
|
+
api.getListCategory({
|
|
540
|
+
categoryId: category.id,
|
|
541
|
+
index: 0,
|
|
542
|
+
appSecret,
|
|
543
|
+
})
|
|
544
|
+
)
|
|
545
|
+
.then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
|
|
546
|
+
)
|
|
547
|
+
const promises = [...requestChain]
|
|
548
|
+
if (hasCategoryId) {
|
|
549
|
+
promises.push(request.send(api.getListAddition(param)))
|
|
550
|
+
}
|
|
551
|
+
const result = await Promise.all(promises)
|
|
552
|
+
return result.filter((item) => item.downLine?.length > 0).slice(0, 6)
|
|
553
|
+
} else {
|
|
554
|
+
// [防呆] 確保有 categoryId
|
|
555
|
+
requestChain = event.data.list
|
|
556
|
+
.filter((category) => category?.id != null)
|
|
557
|
+
.map((category) =>
|
|
558
|
+
request
|
|
559
|
+
.send(
|
|
560
|
+
api.getListCategory({
|
|
561
|
+
categoryId: category.id,
|
|
562
|
+
index: 0,
|
|
563
|
+
appSecret,
|
|
564
|
+
})
|
|
565
|
+
)
|
|
566
|
+
.then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
|
|
567
|
+
)
|
|
568
|
+
const result = await Promise.all([...requestChain])
|
|
569
|
+
return result.filter((item) => item.downLine.length > 0).slice(0, 6)
|
|
570
|
+
}
|
|
571
|
+
},
|
|
484
572
|
getPageContent: async (context, event) => {
|
|
485
573
|
const { room, index, additionEnable, staticData } = context
|
|
486
574
|
// [防呆] 確保有 categoryId
|