@jetthai/cuora 1.1.394 → 1.1.395-payment-1

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +1 -89
  2. package/package.json +1 -1
  3. package/resetGitBranch.sh +10 -0
  4. package/src/api/activity.js +4 -6
  5. package/src/api/auth.js +2 -2
  6. package/src/api/common.js +1 -1
  7. package/src/api/game.js +13 -25
  8. package/src/api/payment.js +5 -9
  9. package/src/api/ranking.js +6 -6
  10. package/src/api/user.js +10 -15
  11. package/src/lib/{fingerprint_v3_11_12.js → fingerprint_v3_11_5.js} +4205 -3742
  12. package/src/machine/activity/continue_deposit_activity.js +1 -2
  13. package/src/machine/activity/fafafa_activity.js +1 -2
  14. package/src/machine/activity/return_bonus_activity.js +1 -2
  15. package/src/machine/activity/sign_in_activity.js +1 -2
  16. package/src/machine/activity/specify_bets_activity.js +1 -2
  17. package/src/machine/activity/specify_turnover_activity.js +1 -2
  18. package/src/machine/auth.js +6 -9
  19. package/src/machine/bank_binding.js +10 -68
  20. package/src/machine/common.js +8 -34
  21. package/src/machine/deposit/amb.js +1 -1
  22. package/src/machine/deposit/crypto_bank.js +2 -10
  23. package/src/machine/deposit/crypto_bank_cash.js +2 -10
  24. package/src/machine/deposit/crypto_way.js +2 -10
  25. package/src/machine/deposit/crypto_way_cash.js +2 -10
  26. package/src/machine/deposit/deposit_fc.js +3 -11
  27. package/src/machine/deposit/direct.js +4 -12
  28. package/src/machine/deposit/direct_cash.js +4 -12
  29. package/src/machine/deposit/float.js +4 -12
  30. package/src/machine/deposit/loadcard_cash.js +3 -11
  31. package/src/machine/deposit/loadcard_vn.js +3 -11
  32. package/src/machine/deposit/manual_cash.js +4 -12
  33. package/src/machine/deposit/manual_vn.js +3 -11
  34. package/src/machine/deposit/qrcode_cash.js +3 -11
  35. package/src/machine/deposit/qrcode_v2.js +3 -11
  36. package/src/machine/deposit/virtual_bank_cash.js +3 -11
  37. package/src/machine/deposit/virtual_bank_vn.js +3 -11
  38. package/src/machine/deposit/vpay.js +4 -12
  39. package/src/machine/game_replay.js +2 -2
  40. package/src/machine/game_search_cash.js +7 -10
  41. package/src/machine/game_search_v2.js +10 -10
  42. package/src/machine/game_v2_1.js +9 -22
  43. package/src/machine/honor_board_cash.js +1 -1
  44. package/src/machine/inbox.js +8 -22
  45. package/src/machine/index.js +0 -2
  46. package/src/machine/ranking.js +11 -14
  47. package/src/machine/reward.js +5 -58
  48. package/src/machine/reward_cash.js +3 -60
  49. package/src/machine/reward_fc.js +1 -2
  50. package/src/machine/side_cash.js +2 -3
  51. package/src/machine/side_v2.js +4 -5
  52. package/src/machine/user_reset_password.js +4 -5
  53. package/src/machine/user_sign_up.js +2 -6
  54. package/src/machine/vip_table.js +4 -11
  55. package/src/machine/withdraw/withdraw_crypto_cash.js +2 -10
  56. package/src/machine/withdraw/withdraw_manual.js +96 -11
  57. package/src/machine/withdraw/withdraw_manual_cash.js +1 -1
  58. package/src/request/request.js +7 -245
  59. package/src/util/deviceToken.js +2 -26
  60. package/src/util/index.js +2 -2
  61. package/src/util/storage.js +4 -18
  62. package/src/machine/game_betslip.js +0 -46
@@ -291,16 +291,8 @@ export default function (request) {
291
291
  }
292
292
  }),
293
293
  setCalculation: assign((context, event) => {
294
- // V2接口轉換中回傳的資料結構不同
295
- const { data } = event.data
296
- if (data) {
297
- return {
298
- calculation: data,
299
- }
300
- } else {
301
- return {
302
- calculation: event.data,
303
- }
294
+ return {
295
+ calculation: event.data,
304
296
  }
305
297
  }),
306
298
  setProcessing: assign((context, event) => {
@@ -410,7 +402,7 @@ export default function (request) {
410
402
  return await request.send(
411
403
  payment.getDepositExpectedResult({
412
404
  method,
413
- amount: Number(amount),
405
+ amount,
414
406
  promotionsNo: promotion?.activityNo,
415
407
  })
416
408
  )
@@ -170,16 +170,8 @@ export default function (request, context) {
170
170
  return { selectedAmount: event.data }
171
171
  }),
172
172
  setCalculation: assign((context, event) => {
173
- // V2接口轉換中回傳的資料結構不同
174
- const { data } = event.data
175
- if (data) {
176
- return {
177
- calculation: data,
178
- }
179
- } else {
180
- return {
181
- calculation: event.data,
182
- }
173
+ return {
174
+ calculation: event.data,
183
175
  }
184
176
  }),
185
177
  clearCalculation: assign((context, event) => {
@@ -204,7 +196,7 @@ export default function (request, context) {
204
196
  return await request.send(
205
197
  payment.getDepositExpectedResult({
206
198
  method: selectedQrcode.method,
207
- amount: Number(selectedAmount),
199
+ amount: selectedAmount,
208
200
  promotionsNo: promotion?.promotionsNo,
209
201
  })
210
202
  )
@@ -260,16 +260,8 @@ export default function (request) {
260
260
  return { selectedAmount: event.data }
261
261
  }),
262
262
  setCalculation: assign((context, event) => {
263
- // V2接口轉換中回傳的資料結構不同
264
- const { data } = event.data
265
- if (data) {
266
- return {
267
- calculation: data,
268
- }
269
- } else {
270
- return {
271
- calculation: event.data,
272
- }
263
+ return {
264
+ calculation: event.data,
273
265
  }
274
266
  }),
275
267
  clearCalculation: assign((context, event) => {
@@ -317,7 +309,7 @@ export default function (request) {
317
309
  return await request.send(
318
310
  payment.getDepositExpectedResult({
319
311
  method: currentMethod,
320
- amount: Number(selectedAmount),
312
+ amount: selectedAmount,
321
313
  promotionsNo: promotion?.activityNo,
322
314
  })
323
315
  )
@@ -128,16 +128,8 @@ export default function (request, context) {
128
128
  return { selectedAmount: event.data }
129
129
  }),
130
130
  setCalculation: assign((context, event) => {
131
- // V2接口轉換中回傳的資料結構不同
132
- const { data } = event.data
133
- if (data) {
134
- return {
135
- calculation: data,
136
- }
137
- } else {
138
- return {
139
- calculation: event.data,
140
- }
131
+ return {
132
+ calculation: event.data,
141
133
  }
142
134
  }),
143
135
  setProcessing: assign((context, event) => {
@@ -187,7 +179,7 @@ export default function (request, context) {
187
179
  return await request.send(
188
180
  payment.getDepositExpectedResult({
189
181
  method,
190
- amount: Number(selectedAmount),
182
+ amount: selectedAmount,
191
183
  promotionsNo: promotion?.promotionsNo,
192
184
  })
193
185
  )
@@ -190,16 +190,8 @@ export default function (request) {
190
190
  }
191
191
  }),
192
192
  setCalculation: assign((context, event) => {
193
- // V2接口轉換中回傳的資料結構不同
194
- const { data } = event.data
195
- if (data) {
196
- return {
197
- calculation: data,
198
- }
199
- } else {
200
- return {
201
- calculation: event.data,
202
- }
193
+ return {
194
+ calculation: event.data,
203
195
  }
204
196
  }),
205
197
  setProcessing: assign((context, event) => {
@@ -247,7 +239,7 @@ export default function (request) {
247
239
  return await request.send(
248
240
  payment.getDepositExpectedResult({
249
241
  method,
250
- amount: Number(amount),
242
+ amount,
251
243
  promotionsNo: promotion?.activityNo,
252
244
  })
253
245
  )
@@ -267,7 +267,7 @@ export default function (request) {
267
267
  options: optional,
268
268
  minimum,
269
269
  maximum,
270
- bankList: bankList?.data ? bankList.data : bankList,
270
+ bankList,
271
271
  grandTotalEnable,
272
272
  }
273
273
  }),
@@ -287,16 +287,8 @@ export default function (request) {
287
287
  return { amount: event.data }
288
288
  }),
289
289
  setCalculation: assign((context, event) => {
290
- // V2接口轉換中回傳的資料結構不同
291
- const { data } = event.data
292
- if (data) {
293
- return {
294
- calculation: data,
295
- }
296
- } else {
297
- return {
298
- calculation: event.data,
299
- }
290
+ return {
291
+ calculation: event.data,
300
292
  }
301
293
  }),
302
294
  clearCalculation: assign((context, event) => {
@@ -356,7 +348,7 @@ export default function (request) {
356
348
  return await request.send(
357
349
  payment.getDepositExpectedResult({
358
350
  method,
359
- amount: Number(amount),
351
+ amount,
360
352
  promotionsNo: promotion?.activityNo,
361
353
  })
362
354
  )
@@ -2,7 +2,7 @@ import { assign, createMachine } from 'xstate'
2
2
  import game from '../api/game.js'
3
3
 
4
4
  export default function (request, context) {
5
- const { appSecret } = request.config
5
+ // const { appSecret } = request.config
6
6
  const { providerId, seqNo, lang } = context
7
7
  return createMachine(
8
8
  {
@@ -38,7 +38,7 @@ export default function (request, context) {
38
38
  services: {
39
39
  // 取得遊戲重播資訊
40
40
  fetchGameReplayInfo: async (context, event) => {
41
- return await request.send(game.getGameReplayInfo({ providerId, seqNo, lang, appSecret }))
41
+ return await request.send(game.getGameReplayInfo({ providerId, seqNo, lang }))
42
42
  },
43
43
  },
44
44
  }
@@ -27,9 +27,9 @@ export default function (request) {
27
27
  recentlyGame: [],
28
28
  youMayLike: [],
29
29
  selectedType: null,
30
- isYouMayLike: false,
31
- isRecentlyGame: false,
32
- isRecentlySearch: false,
30
+ isYouMayLike: null,
31
+ isRecentlyGame: null,
32
+ isRecentlySearch: null,
33
33
  },
34
34
  states: {
35
35
  init: {
@@ -66,9 +66,6 @@ export default function (request) {
66
66
  },
67
67
  },
68
68
  },
69
- resetDebounce: {
70
- always: 'debouncing',
71
- },
72
69
  debouncing: {
73
70
  after: {
74
71
  500: {
@@ -138,12 +135,12 @@ export default function (request) {
138
135
  },
139
136
  on: {
140
137
  SET_KEYWORD: {
141
- target: '.resetDebounce',
138
+ target: '.debouncing',
142
139
  actions: ['setKeyword', 'setLang'],
143
140
  cond: 'isInitialized',
144
141
  },
145
142
  CLEAR_KEYWORD: {
146
- target: '.resetDebounce',
143
+ target: '.debouncing',
147
144
  actions: 'clearKeyword',
148
145
  },
149
146
  SET_TAG_ID: [
@@ -267,7 +264,7 @@ export default function (request) {
267
264
  setGameCode: assign((context, event) => {
268
265
  const { gameList } = context
269
266
  const gameCode = event.data
270
- const gameCodeIndex = gameList.findIndex((game) => game?.gameCode === gameCode)
267
+ const gameCodeIndex = gameList.findIndex((game) => game === gameCode)
271
268
  return {
272
269
  gameCode,
273
270
  gameCodeIndex,
@@ -391,7 +388,7 @@ export default function (request) {
391
388
  sendMayLikeTrace: async (context, event) => {
392
389
  return await request.send(
393
390
  game.setGameSearchTrace({
394
- isYouMayLike: true,
391
+ isYouMayLike: 1,
395
392
  })
396
393
  )
397
394
  },
@@ -21,9 +21,9 @@ export default function (request) {
21
21
  click: null,
22
22
  clickDefault: null,
23
23
  traceId: null,
24
- isYouMayLike: false,
25
- isRecentlyGame: false,
26
- isRecentlySearch: false,
24
+ isYouMayLike: null,
25
+ isRecentlyGame: null,
26
+ isRecentlySearch: null,
27
27
  gameCode: null,
28
28
  lang: 'en-US',
29
29
  },
@@ -119,9 +119,9 @@ export default function (request) {
119
119
  data: {
120
120
  tagId: context.tagList[0]?.id,
121
121
  traceData: {
122
- isYouMayLike: false,
123
- isRecentlyGame: false,
124
- isRecentlySearch: false,
122
+ isYouMayLike: null,
123
+ isRecentlyGame: null,
124
+ isRecentlySearch: null,
125
125
  },
126
126
  },
127
127
  })),
@@ -305,7 +305,7 @@ export default function (request) {
305
305
  setGameCode: assign((context, event) => {
306
306
  const { gameList } = context
307
307
  const gameCode = event.data
308
- const gameCodeIndex = gameList.findIndex((game) => game?.gameCode === gameCode)
308
+ const gameCodeIndex = gameList.findIndex((game) => game === gameCode)
309
309
  return {
310
310
  gameCode,
311
311
  gameCodeIndex,
@@ -319,9 +319,9 @@ export default function (request) {
319
319
  tagIndex: null,
320
320
  gameCode: null,
321
321
  gameCodeIndex: null,
322
- isYouMayLike: false,
323
- isRecentlyGame: false,
324
- isRecentlySearch: false,
322
+ isYouMayLike: null,
323
+ isRecentlyGame: null,
324
+ isRecentlySearch: null,
325
325
  query: context.keyword,
326
326
  click: null,
327
327
  clickDefault: null,
@@ -5,7 +5,6 @@ import { GAME_SEARCH } from '../util/constant.js'
5
5
 
6
6
  // 對應 intersectionObserver 版本
7
7
  export default function (request) {
8
- const { appSecret } = request.config
9
8
  return createMachine(
10
9
  {
11
10
  id: 'game',
@@ -84,7 +83,7 @@ export default function (request) {
84
83
  },
85
84
  ENTER_GAME: {
86
85
  target: 'connecting',
87
- actions: ['setGameInfo', 'setLang', 'setWalletType'],
86
+ actions: ['setGameInfo', 'setLang', 'setwalletType'],
88
87
  },
89
88
  DEMO_GAME: {
90
89
  target: 'demoGame',
@@ -92,7 +91,7 @@ export default function (request) {
92
91
  },
93
92
  MENU_ENTER_GAME: {
94
93
  target: 'connecting',
95
- actions: ['setGameInfo', 'setLang', 'setWalletType'],
94
+ actions: ['setGameInfo', 'setLang', 'setwalletType'],
96
95
  },
97
96
  UPDATE: {
98
97
  target: 'updating',
@@ -225,15 +224,11 @@ export default function (request) {
225
224
  },
226
225
  MENU_ENTER_GAME: {
227
226
  target: 'connectSwitching',
228
- actions: ['setSwitch', 'setLang', 'setWalletType'],
227
+ actions: ['setSwitch', 'setLang'],
229
228
  },
230
229
  ENTER_GAME_PAUSE: {
231
230
  actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
232
231
  },
233
- ENTER_GAME: {
234
- target: 'connecting',
235
- actions: ['setGameInfo', 'setLang', 'setWalletType'],
236
- },
237
232
  },
238
233
  },
239
234
  playingDemo: {
@@ -246,7 +241,7 @@ export default function (request) {
246
241
  },
247
242
  ENTER_GAME: {
248
243
  target: 'connecting',
249
- actions: ['setGameInfo', 'setLang', 'setWalletType'],
244
+ actions: ['setGameInfo', 'setLang', 'setwalletType'],
250
245
  },
251
246
  },
252
247
  },
@@ -460,7 +455,7 @@ export default function (request) {
460
455
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = context.switchGame
461
456
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
462
457
  }),
463
- setWalletType: assign((context, event) => {
458
+ setwalletType: assign((context, event) => {
464
459
  return { walletType: event.data.walletType }
465
460
  }),
466
461
  setLang: assign((context, event) => {
@@ -516,14 +511,13 @@ export default function (request) {
516
511
  })
517
512
  return list.filter((item) => item.downLine.length > 0).slice(0, 6)
518
513
  } else if (additionEnable) {
519
- const param = { categoryId: room.categoryId, index, appSecret }
514
+ const param = { categoryId: room.categoryId, index }
520
515
  requestChain = event.data.list.map((category, b) => {
521
516
  return request
522
517
  .send(
523
518
  api.getListCategory({
524
519
  categoryId: category.id,
525
520
  index: 0,
526
- appSecret,
527
521
  })
528
522
  )
529
523
  .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
@@ -537,7 +531,6 @@ export default function (request) {
537
531
  api.getListCategory({
538
532
  categoryId: category.id,
539
533
  index: 0,
540
- appSecret,
541
534
  })
542
535
  )
543
536
  .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
@@ -561,10 +554,10 @@ export default function (request) {
561
554
  },
562
555
  ]
563
556
  } else if (additionEnable) {
564
- const param = { categoryId: room.categoryId, index, appSecret }
557
+ const param = { categoryId: room.categoryId, index }
565
558
  return await Promise.all([request.send(api.getListCategory(param)), request.send(api.getListAddition(param))])
566
559
  } else {
567
- const param = { categoryId: room.categoryId, index, appSecret }
560
+ const param = { categoryId: room.categoryId, index }
568
561
  return await Promise.all([request.send(api.getListCategory(param))])
569
562
  }
570
563
  },
@@ -581,7 +574,6 @@ export default function (request) {
581
574
  categoryId: room.categoryId,
582
575
  end: index,
583
576
  timestamp: content.timestamp,
584
- appSecret,
585
577
  })
586
578
  ),
587
579
  request.send(
@@ -589,7 +581,6 @@ export default function (request) {
589
581
  categoryId: room.categoryId,
590
582
  end: index,
591
583
  timestamp: content.timestamp,
592
- appSecret,
593
584
  })
594
585
  ),
595
586
  ])
@@ -600,7 +591,6 @@ export default function (request) {
600
591
  categoryId: room.categoryId,
601
592
  end: index,
602
593
  timestamp: content.timestamp,
603
- appSecret,
604
594
  })
605
595
  ),
606
596
  ])
@@ -619,9 +609,7 @@ export default function (request) {
619
609
  is_mobile: isMobile === 'mobile' ? 'y' : null,
620
610
  lang,
621
611
  selected_wallet_type: walletType,
622
- return_url: returnProviders.includes(providerId)
623
- ? `${window.location.origin}${context.base}return`
624
- : window.location.href?.split('?')?.[0], // For providers to return.
612
+ return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
625
613
  }
626
614
  const { type, redirect_url, gameToken, gameHtml, wallet_type } = await request.send(api.playGame(params))
627
615
  return { type, gameToken, gameHtml, gameURL: redirect_url, gameWalletType: wallet_type }
@@ -637,7 +625,6 @@ export default function (request) {
637
625
  mapping_id: mappingId,
638
626
  is_mobile: isMobile === 'mobile' ? 'y' : null,
639
627
  lang,
640
- appSecret,
641
628
  }
642
629
  const { type, redirect_url, gameToken, gameHtml, is_demo } = await request.send(api.demoGame(params))
643
630
  // 將 is_demo 設置到 context.game.isDemo
@@ -80,7 +80,7 @@ export default function (request) {
80
80
  },
81
81
  services: {
82
82
  fetchHonorBoardList: async (context, event) => {
83
- const { data } = await request.send(activity.getHonorBroadcast({ appSecret }))
83
+ const { data } = await request.send(activity.getHonorBroadcast(appSecret))
84
84
  return data
85
85
  },
86
86
  },
@@ -247,9 +247,6 @@ export default function (request) {
247
247
  CLEAR: {
248
248
  actions: 'hideMessage',
249
249
  },
250
- SET_LANG: {
251
- actions: 'setLang',
252
- },
253
250
  },
254
251
  },
255
252
  {
@@ -279,10 +276,6 @@ export default function (request) {
279
276
  },
280
277
  },
281
278
  actions: {
282
- setLang: assign((context, event) => {
283
- const lang = event.data.locale || context.lang || 'en-US'
284
- return { lang }
285
- }),
286
279
  reset: assign((context, event) => {
287
280
  return {
288
281
  currentTab: null,
@@ -292,6 +285,7 @@ export default function (request) {
292
285
  }
293
286
  }),
294
287
  resetPage: assign((context, event) => {
288
+ console.log('updateMessage resetPage')
295
289
  const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
296
290
  inbox[currentTab].page = -1
297
291
  return {
@@ -421,10 +415,9 @@ export default function (request) {
421
415
  return tabs
422
416
  },
423
417
  fetchMessages: async (context, event) => {
424
- const lang = context.lang
425
418
  const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
426
- if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND' || currentTab === 'FREE_GAME')) {
427
- const { data } = await request.send(activity.getRewardList({ count: 30, appSecret, lang }))
419
+ if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND')) {
420
+ const { data } = await request.send(activity.getRewardList({ count: 30, appSecret }))
428
421
  inbox[currentTab] = { data, page: 0, totalPage: 1 }
429
422
  } else {
430
423
  const { page = -1 } = inbox[currentTab] || {}
@@ -436,18 +429,11 @@ export default function (request) {
436
429
  return inbox
437
430
  },
438
431
  reFetchMessages: async (context, event) => {
439
- const lang = context.lang
440
- const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
441
-
442
- if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND' || currentTab === 'FREE_GAME')) {
443
- const { data } = await request.send(activity.getRewardList({ count: 30, appSecret, lang }))
444
- inbox[currentTab] = { data, page: 0, totalPage: 1 }
445
- } else {
446
- const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
447
- let formattedData = []
448
- formattedData = data?.map((item) => ({ ...item, isSelected: false }))
449
- inbox[currentTab] = { data: formattedData, ...rest }
450
- }
432
+ const { currentTab, inbox } = JSON.parse(JSON.stringify(context))
433
+ const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
434
+ let formattedData = []
435
+ formattedData = data?.map((item) => ({ ...item, isSelected: false }))
436
+ inbox[currentTab] = { data: formattedData, ...rest }
451
437
  return inbox
452
438
  },
453
439
  updateMessageIsRead: async (context, event) => {
@@ -10,7 +10,6 @@ import game_search_v2 from './game_search_v2.js'
10
10
  import game_hot_new from './game_hot_new.js'
11
11
  import game_info from './game_info.js'
12
12
  import game_replay from './game_replay.js'
13
- import game_betslip from './game_betslip.js'
14
13
  import inbox from './inbox.js'
15
14
  import merge from './merge.js'
16
15
  import payment_data from './payment_data.js'
@@ -54,7 +53,6 @@ export default {
54
53
  game_hot_new,
55
54
  game_info,
56
55
  game_replay,
57
- game_betslip,
58
56
  inbox,
59
57
  merge,
60
58
  payment_data,
@@ -2,15 +2,12 @@ import { createMachine, assign } from 'xstate'
2
2
  import ranking from '../api/ranking.js'
3
3
 
4
4
  export default function (request) {
5
- const { appSecret } = request.config
6
5
  const cycleMapping = ['DAILY', 'WEEKLY', 'MONTHLY']
7
- const limit = { DAILY: 56, WEEKLY: 8, MONTHLY: 2, ALL: 2 }
8
6
 
9
- function roundProcess(rounds, cycles) {
7
+ function roundProcess(rounds) {
10
8
  const roundArrays = rounds.map((round) => Array.from({ length: round }, (_, i) => i + 1))
11
9
  return roundArrays.reduce((acc, roundArray, index) => {
12
- const max = limit[cycles[index]] || rounds[index] // 若沒限制則取全部
13
- acc[cycles[index]] = roundArray.reverse().slice(0, max)
10
+ acc[cycleMapping[index]] = roundArray.reverse()
14
11
  return acc
15
12
  }, {})
16
13
  }
@@ -154,14 +151,14 @@ export default function (request) {
154
151
  }
155
152
  }),
156
153
  setRankingOptions: assign((context, event) => {
157
- const isChampion = event.data?.rule === 'CHAMPION'
158
154
  const cycle = event.data?.cycle
159
155
  const currentRound = event.data?.currentRound || []
160
156
  // 取得結算週期選單列表
161
- const cycleOptions = isChampion ? cycleMapping.slice(0, currentRound.length) : [cycle]
162
- const roundOptions = roundProcess(currentRound, cycleOptions)
163
- // 如果是冠軍龍虎月結算,則加入全部選項
164
- if (cycle === 'MONTHLY' && isChampion) {
157
+ const cycleOptions = cycleMapping.slice(0, currentRound.length)
158
+ // 取得每週期的歷史期數選單列表
159
+ const roundOptions = roundProcess(currentRound)
160
+ // 如果是月結算,則加入全部選項
161
+ if (cycle === 'MONTHLY') {
165
162
  cycleOptions.push('ALL')
166
163
  roundOptions.ALL = roundOptions.MONTHLY
167
164
  }
@@ -169,7 +166,7 @@ export default function (request) {
169
166
  ...event.data,
170
167
  options: { cycle: cycleOptions, round: roundOptions },
171
168
  // 初始固定顯示 DAILY
172
- cycle: isChampion ? 'DAILY' : cycle,
169
+ cycle: event.data?.rule !== 'NORMAL' ? 'DAILY' : cycle,
173
170
  round: currentRound[0],
174
171
  }
175
172
  }),
@@ -195,12 +192,12 @@ export default function (request) {
195
192
  services: {
196
193
  fetchTournament: async (context) => {
197
194
  const { activityNo, cycle, round, site } = context
198
- const { data } = await request.send(ranking.getTournament({ activityNo, cycle, round, site, appSecret }))
195
+ const { data } = await request.send(ranking.getTournament({ activityNo, cycle, round, site }))
199
196
  return data
200
197
  },
201
198
  fetchRankingOptions: async (context) => {
202
199
  const { activityNo } = context
203
- const { data } = await request.send(ranking.getRankingOptions({ activityNo, appSecret }))
200
+ const { data } = await request.send(ranking.getRankingOptions({ activityNo }))
204
201
  return data
205
202
  },
206
203
  fetchRankingDetail: async (context, event) => {
@@ -210,7 +207,7 @@ export default function (request) {
210
207
  },
211
208
  fetchRankingGames: async (context) => {
212
209
  const { activityNo } = context
213
- const { data } = await request.send(ranking.getRankingGames({ activityNo, appSecret }))
210
+ const { data } = await request.send(ranking.getRankingGames({ activityNo }))
214
211
  return data
215
212
  },
216
213
  },