@jetthai/cuora 1.1.372 → 1.1.373-dev-2
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 +26 -0
- package/package.json +1 -1
- package/src/api/activity.js +1 -1
- package/src/api/auth.js +2 -2
- package/src/api/common.js +1 -1
- package/src/api/payment.js +5 -5
- package/src/api/ranking.js +4 -4
- package/src/machine/common.js +5 -5
- package/src/machine/deposit/deposit_fc.js +10 -3
- package/src/machine/deposit/direct.js +10 -3
- package/src/machine/deposit/direct_cash.js +10 -3
- package/src/machine/deposit/float.js +10 -3
- package/src/machine/deposit/loadcard_cash.js +10 -3
- package/src/machine/deposit/loadcard_vn.js +10 -3
- package/src/machine/deposit/manual_cash.js +10 -3
- package/src/machine/deposit/manual_vn.js +10 -3
- package/src/machine/deposit/qrcode_cash.js +10 -3
- package/src/machine/deposit/qrcode_v2.js +10 -3
- package/src/machine/deposit/virtual_bank_cash.js +10 -3
- package/src/machine/deposit/virtual_bank_vn.js +10 -3
- package/src/machine/deposit/vpay.js +10 -3
- package/src/machine/game_v2_1.js +2 -2
- package/src/machine/honor_board_cash.js +1 -1
- package/src/machine/ranking.js +3 -2
- package/src/machine/vip_table.js +11 -4
- package/src/request/request.js +216 -7
- package/src/util/sessionStorage.js +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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.373-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.373-dev-1...v1.1.373-dev-2) (2025-08-16)
|
|
6
|
+
|
|
7
|
+
### [1.1.373-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.373...v1.1.373-dev-1) (2025-08-15)
|
|
8
|
+
|
|
9
|
+
### [1.1.373](https://github.com/jetthai/cuora-module/compare/v1.1.372...v1.1.373) (2025-08-13)
|
|
10
|
+
|
|
5
11
|
### [1.1.372](https://github.com/jetthai/cuora-module/compare/v1.1.371...v1.1.372) (2025-08-12)
|
|
6
12
|
|
|
7
13
|
### [1.1.371](https://github.com/jetthai/cuora-module/compare/v1.1.370...v1.1.371) (2025-08-11)
|
|
@@ -14,8 +20,18 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
14
20
|
|
|
15
21
|
### [1.1.367](https://github.com/jetthai/cuora-module/compare/v1.1.366...v1.1.367) (2025-07-22)
|
|
16
22
|
|
|
23
|
+
### [1.1.366-v2api-2](https://github.com/jetthai/cuora-module/compare/v1.1.366-v2api-1...v1.1.366-v2api-2) (2025-07-18)
|
|
24
|
+
|
|
25
|
+
### [1.1.366-v2api-1](https://github.com/jetthai/cuora-module/compare/v1.1.366...v1.1.366-v2api-1) (2025-07-18)
|
|
26
|
+
|
|
17
27
|
### [1.1.366](https://github.com/jetthai/cuora-module/compare/v1.1.365...v1.1.366) (2025-07-18)
|
|
18
28
|
|
|
29
|
+
### [1.1.365-v2api-3](https://github.com/jetthai/cuora-module/compare/v1.1.365-v2api-2...v1.1.365-v2api-3) (2025-07-18)
|
|
30
|
+
|
|
31
|
+
### [1.1.365-v2api-2](https://github.com/jetthai/cuora-module/compare/v1.1.365-v2api-1...v1.1.365-v2api-2) (2025-07-17)
|
|
32
|
+
|
|
33
|
+
### [1.1.365-v2api-1](https://github.com/jetthai/cuora-module/compare/v1.1.365...v1.1.365-v2api-1) (2025-07-17)
|
|
34
|
+
|
|
19
35
|
### [1.1.365](https://github.com/jetthai/cuora-module/compare/v1.1.364...v1.1.365) (2025-07-08)
|
|
20
36
|
|
|
21
37
|
### [1.1.364](https://github.com/jetthai/cuora-module/compare/v1.1.363...v1.1.364) (2025-06-23)
|
|
@@ -24,18 +40,28 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
24
40
|
|
|
25
41
|
### [1.1.362](https://github.com/jetthai/cuora-module/compare/v1.1.361...v1.1.362) (2025-06-20)
|
|
26
42
|
|
|
43
|
+
### [1.1.361-v2api-1](https://github.com/jetthai/cuora-module/compare/v1.1.361...v1.1.361-v2api-1) (2025-06-05)
|
|
44
|
+
|
|
27
45
|
### [1.1.361](https://github.com/jetthai/cuora-module/compare/v1.1.360...v1.1.361) (2025-06-03)
|
|
28
46
|
|
|
29
47
|
### [1.1.360](https://github.com/jetthai/cuora-module/compare/v1.1.359...v1.1.360) (2025-06-03)
|
|
30
48
|
|
|
49
|
+
### [1.1.358-apiv2-2](https://github.com/jetthai/cuora-module/compare/v1.1.359...v1.1.358-apiv2-2) (2025-05-27)
|
|
50
|
+
|
|
31
51
|
### [1.1.359](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.359) (2025-05-23)
|
|
32
52
|
|
|
53
|
+
### [1.1.358-apiv2-1](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.358-apiv2-1) (2025-05-09)
|
|
54
|
+
|
|
33
55
|
### [1.1.358](https://github.com/jetthai/cuora-module/compare/v1.1.357...v1.1.358) (2025-05-09)
|
|
34
56
|
|
|
35
57
|
### [1.1.357](https://github.com/jetthai/cuora-module/compare/v1.1.356...v1.1.357) (2025-05-06)
|
|
36
58
|
|
|
37
59
|
### [1.1.356](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.356) (2025-04-29)
|
|
38
60
|
|
|
61
|
+
### [1.1.355-apiv2-2](https://github.com/jetthai/cuora-module/compare/v1.1.355-apiv2-1...v1.1.355-apiv2-2) (2025-05-07)
|
|
62
|
+
|
|
63
|
+
### [1.1.355-apiv2-1](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.355-apiv2-1) (2025-05-05)
|
|
64
|
+
|
|
39
65
|
### [1.1.355](https://github.com/jetthai/cuora-module/compare/v1.1.353-data-1...v1.1.355) (2025-04-22)
|
|
40
66
|
|
|
41
67
|
### [1.1.354](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.354) (2025-04-14)
|
package/package.json
CHANGED
package/src/api/activity.js
CHANGED
|
@@ -83,7 +83,7 @@ export default {
|
|
|
83
83
|
settleAmount: (data) => ({ url: 'activities/exchange/diamond/settle', method: 'post', params: data }),
|
|
84
84
|
exchange: (data) => ({ url: 'activities/exchange', method: 'post', params: data }),
|
|
85
85
|
collect: (data) => ({ url: 'activities/collect', method: 'post', params: data }),
|
|
86
|
-
getVipTable: () => ({ url: 'activities/viptable', method: 'get' }),
|
|
86
|
+
getVipTable: ({ appSecret }) => ({ url: 'activities/viptable', method: 'get', params: { appSecret } }),
|
|
87
87
|
getRankingList: () => ({ url: 'activities/ranking', method: 'get' }),
|
|
88
88
|
exchangeDiamond: ({ activityNo, exchangeAward = [] }) => ({
|
|
89
89
|
url: 'activities/exchange/diamond',
|
package/src/api/auth.js
CHANGED
|
@@ -54,10 +54,10 @@ export default {
|
|
|
54
54
|
method: 'post',
|
|
55
55
|
params: { provider, countryCode, phone, email },
|
|
56
56
|
}),
|
|
57
|
-
checkAccount: ({ account, nick_name, strategy }) => ({
|
|
57
|
+
checkAccount: ({ account, nick_name, strategy, appSecret }) => ({
|
|
58
58
|
url: 'checkAccount',
|
|
59
59
|
method: 'post',
|
|
60
|
-
params: { account, nick_name, strategy },
|
|
60
|
+
params: { account, nick_name, strategy, appSecret },
|
|
61
61
|
isPublic: true,
|
|
62
62
|
}),
|
|
63
63
|
}
|
package/src/api/common.js
CHANGED
|
@@ -2,7 +2,7 @@ export default {
|
|
|
2
2
|
getConfig: ({ appSecret }) => ({ url: 'getConfig', method: 'get', params: { appSecret }, isPublic: true }),
|
|
3
3
|
getLayoutConfig: ({ appSecret }) => ({ url: 'getQuickLayout', method: 'get', params: { appSecret }, isPublic: true }),
|
|
4
4
|
feeds: ({ appSecret }) => ({ url: 'feeds', method: 'get', params: { appSecret }, isPublic: true }),
|
|
5
|
-
broadcast: () => ({ url: 'broadcast', method: 'get', isPublic: true }),
|
|
5
|
+
broadcast: () => ({ url: 'broadcast', method: 'get', params: { appSecret }, isPublic: true }),
|
|
6
6
|
getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
|
|
7
7
|
getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
|
|
8
8
|
getDefaultAffiliateCode: ({ appSecret }) => ({ url: 'getAffiliateCode', params: { appSecret }, method: 'get', isPublic: true }),
|
package/src/api/payment.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
getPaymentHistory: (returnDays) => ({ url: 'payment/v2/history', method: 'post', params: { returnDays } }),
|
|
3
|
-
getSpotMarket: () => ({ url: 'payment/spotmarket', method: 'get' }),
|
|
3
|
+
getSpotMarket: () => ({ url: 'payment/v2/spotmarket', method: 'get' }),
|
|
4
4
|
getTransactionHistory: (payload) => ({
|
|
5
5
|
url: 'payment/v2/transactionHistory',
|
|
6
6
|
method: 'post',
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
}),
|
|
9
9
|
getTransactionHistoryOptions: () => ({ url: 'payment/v2/category/options', method: 'get' }),
|
|
10
10
|
getPaymentInfo: () => ({ url: `payment/v2/paymentInfo`, method: 'get' }),
|
|
11
|
-
getBindingPaymentInfo: () => ({ url: `payment/getBindingPaymentInfo`, method: 'get' }),
|
|
11
|
+
getBindingPaymentInfo: () => ({ url: `payment/v2/getBindingPaymentInfo`, method: 'get' }),
|
|
12
12
|
updatePaymentInfo: ({
|
|
13
13
|
bankCode,
|
|
14
14
|
branch,
|
|
@@ -58,7 +58,7 @@ export default {
|
|
|
58
58
|
}),
|
|
59
59
|
getBankList: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/getBankList`, method: 'get' }),
|
|
60
60
|
getBindingBankList: ({ appSecret }) => ({ url: 'payment/v2/getBindingBankList', method: 'get', params: { appSecret }, isPublic: true }),
|
|
61
|
-
getBindingPaymentList: ({ appSecret }) => ({ url: 'payment/getBindingPaymentList', method: 'get', params: { appSecret }, isPublic: true }),
|
|
61
|
+
getBindingPaymentList: ({ appSecret }) => ({ url: 'payment/v2/getBindingPaymentList', method: 'get', params: { appSecret }, isPublic: true }),
|
|
62
62
|
getWithdrawBankList: () => ({ url: 'payment/v2/getWithdrawBankList', method: 'get' }),
|
|
63
63
|
makeTransaction: ({ type, payload, paymentMethod }) => ({
|
|
64
64
|
url: `payment/v2/${paymentMethod}/transaction`,
|
|
@@ -68,7 +68,7 @@ export default {
|
|
|
68
68
|
...payload,
|
|
69
69
|
},
|
|
70
70
|
}),
|
|
71
|
-
checkTransaction: (paymentMethod) => ({ url: `payment/${paymentMethod}/checkTransaction`, method: 'post' }),
|
|
71
|
+
checkTransaction: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/checkTransaction`, method: 'post' }),
|
|
72
72
|
setBonusSetting: ({ bonus }) => ({ url: 'payment/v2/setting', method: 'post', params: { bonus } }),
|
|
73
73
|
getCurrentWithdrawRule: () => ({ url: 'payment/v2/getCurrentWithdrawRule', method: 'get' }),
|
|
74
74
|
getDoubleWalletWithdrawRule: ({ walletType }) => ({
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
method: 'post',
|
|
82
82
|
params: { exchangeType, cryptoNetwork, targetAddress },
|
|
83
83
|
}),
|
|
84
|
-
mergeWallet: () => ({ url: 'payment/mergeWallet', method: 'post' }),
|
|
84
|
+
mergeWallet: () => ({ url: 'payment/v2/mergeWallet', method: 'post' }),
|
|
85
85
|
getPaymentDetail: ({ transferType } = {}) => ({
|
|
86
86
|
url: 'payment/v2/paymentDetail',
|
|
87
87
|
method: 'post',
|
package/src/api/ranking.js
CHANGED
|
@@ -7,10 +7,10 @@ export default {
|
|
|
7
7
|
isPublic: true,
|
|
8
8
|
}),
|
|
9
9
|
// 登入後排名預設期數資料
|
|
10
|
-
getRankingOptions: ({ activityNo }) => ({
|
|
10
|
+
getRankingOptions: ({ activityNo, appSecret }) => ({
|
|
11
11
|
url: 'ranking/detail/option',
|
|
12
12
|
method: 'get',
|
|
13
|
-
params: { activityNo },
|
|
13
|
+
params: { activityNo, appSecret },
|
|
14
14
|
isPublic: true,
|
|
15
15
|
}),
|
|
16
16
|
// 登入後排名資料
|
|
@@ -19,9 +19,9 @@ export default {
|
|
|
19
19
|
method: 'post',
|
|
20
20
|
params: { activityNo, cycle, round },
|
|
21
21
|
}),
|
|
22
|
-
getRankingGames: ({ activityNo }) => ({
|
|
22
|
+
getRankingGames: ({ activityNo, appSecret }) => ({
|
|
23
23
|
url: 'hot-game/ranking',
|
|
24
24
|
method: 'get',
|
|
25
|
-
params: { activityNo },
|
|
25
|
+
params: { activityNo, appSecret },
|
|
26
26
|
}),
|
|
27
27
|
}
|
package/src/machine/common.js
CHANGED
|
@@ -3,6 +3,7 @@ import { assign, createMachine } from 'xstate'
|
|
|
3
3
|
import pickBy from 'lodash/pickBy.js'
|
|
4
4
|
import api from '../api/common.js'
|
|
5
5
|
import storage from '../util/storage.js'
|
|
6
|
+
import sessionStorage from '../util/sessionStorage.js'
|
|
6
7
|
|
|
7
8
|
export default function (request) {
|
|
8
9
|
const { appSecret, defaultChannel, defaultSubchannel } = request.config
|
|
@@ -258,7 +259,7 @@ export default function (request) {
|
|
|
258
259
|
const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
|
|
259
260
|
const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
|
|
260
261
|
const affiliateCode = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode')
|
|
261
|
-
const friendCode = urlParams.get('fc') || urlParams.get('affiliate') ||
|
|
262
|
+
const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || sessionStorage.get('fc') || sessionStorage.get('affiliate')
|
|
262
263
|
|
|
263
264
|
storage.set('channel', channel, {
|
|
264
265
|
path: '/',
|
|
@@ -272,7 +273,7 @@ export default function (request) {
|
|
|
272
273
|
path: '/',
|
|
273
274
|
maxAge: 60 * 60 * 24 * 7,
|
|
274
275
|
})
|
|
275
|
-
|
|
276
|
+
sessionStorage.set('fc', friendCode, {
|
|
276
277
|
path: '/',
|
|
277
278
|
maxAge: 60 * 60 * 24 * 7,
|
|
278
279
|
})
|
|
@@ -293,14 +294,13 @@ export default function (request) {
|
|
|
293
294
|
return { announcementList: { data } }
|
|
294
295
|
}),
|
|
295
296
|
setFeeds: assign((context, event) => {
|
|
296
|
-
const {
|
|
297
|
+
const { broadcastList, mailBoxInfo } = event.data
|
|
297
298
|
const { siteConfig } = context
|
|
298
|
-
const promotions = announcementList?.announcements?.filter?.((item) => item.category === 3) || []
|
|
299
299
|
const customerMessageEnable = siteConfig?.csChat?.some((item) => item.enable && item.name === 'customermessage')
|
|
300
300
|
if (!customerMessageEnable) {
|
|
301
301
|
mailBoxInfo.rows -= mailBoxInfo.detailRows?.CUSTOMER || 0
|
|
302
302
|
}
|
|
303
|
-
return { broadcastList, mailBoxInfo
|
|
303
|
+
return { broadcastList, mailBoxInfo }
|
|
304
304
|
}),
|
|
305
305
|
setBroadcast: assign((context, event) => {
|
|
306
306
|
const { broadcastList, sentNormalBroadcastList, normalBroadcast } = context
|
|
@@ -180,8 +180,15 @@ export default function (request) {
|
|
|
180
180
|
return properties
|
|
181
181
|
}),
|
|
182
182
|
setCalculatedResult: assign((context, event) => {
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
const { data } = event.data
|
|
184
|
+
if (data) {
|
|
185
|
+
return {
|
|
186
|
+
calculatedResult: data,
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
return {
|
|
190
|
+
calculatedResult: event.data,
|
|
191
|
+
}
|
|
185
192
|
}
|
|
186
193
|
}),
|
|
187
194
|
setSubmittedResult: assign((context, event) => {
|
|
@@ -233,7 +240,7 @@ export default function (request) {
|
|
|
233
240
|
return await request.send(
|
|
234
241
|
payment.getDepositExpectedResult({
|
|
235
242
|
method: currentCrypto.method,
|
|
236
|
-
amount: currentAmount,
|
|
243
|
+
amount: Number(currentAmount),
|
|
237
244
|
cryptoCurrency: currentCrypto.channel,
|
|
238
245
|
})
|
|
239
246
|
)
|
|
@@ -220,8 +220,15 @@ export default function (request) {
|
|
|
220
220
|
}
|
|
221
221
|
}),
|
|
222
222
|
setCalculation: assign((context, event) => {
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
const { data } = event.data
|
|
224
|
+
if (data) {
|
|
225
|
+
return {
|
|
226
|
+
calculation: data,
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
return {
|
|
230
|
+
calculation: event.data,
|
|
231
|
+
}
|
|
225
232
|
}
|
|
226
233
|
}),
|
|
227
234
|
clearCalculation: assign((context, event) => {
|
|
@@ -280,7 +287,7 @@ export default function (request) {
|
|
|
280
287
|
return await request.send(
|
|
281
288
|
payment.getDepositExpectedResult({
|
|
282
289
|
method: currentMethod,
|
|
283
|
-
amount,
|
|
290
|
+
amount: Number(amount),
|
|
284
291
|
promotionsNo: promotion?.activityNo,
|
|
285
292
|
})
|
|
286
293
|
)
|
|
@@ -144,8 +144,15 @@ export default function (request, context) {
|
|
|
144
144
|
}
|
|
145
145
|
}),
|
|
146
146
|
setCalculation: assign((context, event) => {
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
const { data } = event.data
|
|
148
|
+
if (data) {
|
|
149
|
+
return {
|
|
150
|
+
calculation: data,
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
return {
|
|
154
|
+
calculation: event.data,
|
|
155
|
+
}
|
|
149
156
|
}
|
|
150
157
|
}),
|
|
151
158
|
clearCalculation: assign((context, event) => {
|
|
@@ -195,7 +202,7 @@ export default function (request, context) {
|
|
|
195
202
|
return await request.send(
|
|
196
203
|
payment.getDepositExpectedResult({
|
|
197
204
|
method: selectedDirect.method,
|
|
198
|
-
amount: selectedAmount,
|
|
205
|
+
amount: Number(selectedAmount),
|
|
199
206
|
promotionsNo: promotion?.promotionsNo,
|
|
200
207
|
})
|
|
201
208
|
)
|
|
@@ -292,8 +292,15 @@ export default function (request) {
|
|
|
292
292
|
}
|
|
293
293
|
}),
|
|
294
294
|
setCalculation: assign((context, event) => {
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
const { data } = event.data
|
|
296
|
+
if (data) {
|
|
297
|
+
return {
|
|
298
|
+
calculation: data,
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
return {
|
|
302
|
+
calculation: event.data,
|
|
303
|
+
}
|
|
297
304
|
}
|
|
298
305
|
}),
|
|
299
306
|
clearCalculation: assign((context, event) => {
|
|
@@ -355,7 +362,7 @@ export default function (request) {
|
|
|
355
362
|
return await request.send(
|
|
356
363
|
payment.getDepositExpectedResult({
|
|
357
364
|
method,
|
|
358
|
-
amount,
|
|
365
|
+
amount: Number(amount),
|
|
359
366
|
promotionsNo: promotion?.activityNo,
|
|
360
367
|
})
|
|
361
368
|
)
|
|
@@ -151,8 +151,15 @@ export default function (request, context) {
|
|
|
151
151
|
return { selectedAmount: event.data }
|
|
152
152
|
}),
|
|
153
153
|
setCalculation: assign((context, event) => {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
const { data } = event.data
|
|
155
|
+
if (data) {
|
|
156
|
+
return {
|
|
157
|
+
calculation: data,
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
return {
|
|
161
|
+
calculation: event.data,
|
|
162
|
+
}
|
|
156
163
|
}
|
|
157
164
|
}),
|
|
158
165
|
clearCalculation: assign((context, event) => {
|
|
@@ -183,7 +190,7 @@ export default function (request, context) {
|
|
|
183
190
|
return await request.send(
|
|
184
191
|
payment.getDepositExpectedResult({
|
|
185
192
|
method: selectedLoadcard.method,
|
|
186
|
-
amount: selectedAmount,
|
|
193
|
+
amount: Number(selectedAmount),
|
|
187
194
|
promotionsNo: promotion?.promotionsNo,
|
|
188
195
|
})
|
|
189
196
|
)
|
|
@@ -265,8 +265,15 @@ export default function (request) {
|
|
|
265
265
|
return { selectedAmount: event.data }
|
|
266
266
|
}),
|
|
267
267
|
setCalculation: assign((context, event) => {
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
const { data } = event.data
|
|
269
|
+
if (data) {
|
|
270
|
+
return {
|
|
271
|
+
calculation: data,
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
return {
|
|
275
|
+
calculation: event.data,
|
|
276
|
+
}
|
|
270
277
|
}
|
|
271
278
|
}),
|
|
272
279
|
clearCalculation: assign((context, event) => {
|
|
@@ -319,7 +326,7 @@ export default function (request) {
|
|
|
319
326
|
return await request.send(
|
|
320
327
|
payment.getDepositExpectedResult({
|
|
321
328
|
method: currentMethod,
|
|
322
|
-
amount: selectedAmount,
|
|
329
|
+
amount: Number(selectedAmount),
|
|
323
330
|
promotionsNo: promotion?.activityNo,
|
|
324
331
|
})
|
|
325
332
|
)
|
|
@@ -200,8 +200,15 @@ export default function (request, context) {
|
|
|
200
200
|
return { selectedAmount: event.data }
|
|
201
201
|
}),
|
|
202
202
|
setCalculation: assign((context, event) => {
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
const { data } = event.data
|
|
204
|
+
if (data) {
|
|
205
|
+
return {
|
|
206
|
+
calculation: data,
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
return {
|
|
210
|
+
calculation: event.data,
|
|
211
|
+
}
|
|
205
212
|
}
|
|
206
213
|
}),
|
|
207
214
|
setProcessing: assign((context, event) => {
|
|
@@ -308,7 +315,7 @@ export default function (request, context) {
|
|
|
308
315
|
return await request.send(
|
|
309
316
|
payment.getDepositExpectedResult({
|
|
310
317
|
method,
|
|
311
|
-
amount: selectedAmount,
|
|
318
|
+
amount: Number(selectedAmount),
|
|
312
319
|
promotionsNo: promotion?.promotionsNo,
|
|
313
320
|
})
|
|
314
321
|
)
|
|
@@ -291,8 +291,15 @@ export default function (request) {
|
|
|
291
291
|
}
|
|
292
292
|
}),
|
|
293
293
|
setCalculation: assign((context, event) => {
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
const { data } = event.data
|
|
295
|
+
if (data) {
|
|
296
|
+
return {
|
|
297
|
+
calculation: data,
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
return {
|
|
301
|
+
calculation: event.data,
|
|
302
|
+
}
|
|
296
303
|
}
|
|
297
304
|
}),
|
|
298
305
|
setProcessing: assign((context, event) => {
|
|
@@ -402,7 +409,7 @@ export default function (request) {
|
|
|
402
409
|
return await request.send(
|
|
403
410
|
payment.getDepositExpectedResult({
|
|
404
411
|
method,
|
|
405
|
-
amount,
|
|
412
|
+
amount: Number(amount),
|
|
406
413
|
promotionsNo: promotion?.activityNo,
|
|
407
414
|
})
|
|
408
415
|
)
|
|
@@ -170,8 +170,15 @@ export default function (request, context) {
|
|
|
170
170
|
return { selectedAmount: event.data }
|
|
171
171
|
}),
|
|
172
172
|
setCalculation: assign((context, event) => {
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
const { data } = event.data
|
|
174
|
+
if (data) {
|
|
175
|
+
return {
|
|
176
|
+
calculation: data,
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
return {
|
|
180
|
+
calculation: event.data,
|
|
181
|
+
}
|
|
175
182
|
}
|
|
176
183
|
}),
|
|
177
184
|
clearCalculation: assign((context, event) => {
|
|
@@ -196,7 +203,7 @@ export default function (request, context) {
|
|
|
196
203
|
return await request.send(
|
|
197
204
|
payment.getDepositExpectedResult({
|
|
198
205
|
method: selectedQrcode.method,
|
|
199
|
-
amount: selectedAmount,
|
|
206
|
+
amount: Number(selectedAmount),
|
|
200
207
|
promotionsNo: promotion?.promotionsNo,
|
|
201
208
|
})
|
|
202
209
|
)
|
|
@@ -260,8 +260,15 @@ export default function (request) {
|
|
|
260
260
|
return { selectedAmount: event.data }
|
|
261
261
|
}),
|
|
262
262
|
setCalculation: assign((context, event) => {
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
const { data } = event.data
|
|
264
|
+
if (data) {
|
|
265
|
+
return {
|
|
266
|
+
calculation: data,
|
|
267
|
+
}
|
|
268
|
+
} else {
|
|
269
|
+
return {
|
|
270
|
+
calculation: event.data,
|
|
271
|
+
}
|
|
265
272
|
}
|
|
266
273
|
}),
|
|
267
274
|
clearCalculation: assign((context, event) => {
|
|
@@ -309,7 +316,7 @@ export default function (request) {
|
|
|
309
316
|
return await request.send(
|
|
310
317
|
payment.getDepositExpectedResult({
|
|
311
318
|
method: currentMethod,
|
|
312
|
-
amount: selectedAmount,
|
|
319
|
+
amount: Number(selectedAmount),
|
|
313
320
|
promotionsNo: promotion?.activityNo,
|
|
314
321
|
})
|
|
315
322
|
)
|
|
@@ -128,8 +128,15 @@ export default function (request, context) {
|
|
|
128
128
|
return { selectedAmount: event.data }
|
|
129
129
|
}),
|
|
130
130
|
setCalculation: assign((context, event) => {
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
const { data } = event.data
|
|
132
|
+
if (data) {
|
|
133
|
+
return {
|
|
134
|
+
calculation: data,
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
return {
|
|
138
|
+
calculation: event.data,
|
|
139
|
+
}
|
|
133
140
|
}
|
|
134
141
|
}),
|
|
135
142
|
setProcessing: assign((context, event) => {
|
|
@@ -179,7 +186,7 @@ export default function (request, context) {
|
|
|
179
186
|
return await request.send(
|
|
180
187
|
payment.getDepositExpectedResult({
|
|
181
188
|
method,
|
|
182
|
-
amount: selectedAmount,
|
|
189
|
+
amount: Number(selectedAmount),
|
|
183
190
|
promotionsNo: promotion?.promotionsNo,
|
|
184
191
|
})
|
|
185
192
|
)
|
|
@@ -190,8 +190,15 @@ export default function (request) {
|
|
|
190
190
|
}
|
|
191
191
|
}),
|
|
192
192
|
setCalculation: assign((context, event) => {
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
const { data } = event.data
|
|
194
|
+
if (data) {
|
|
195
|
+
return {
|
|
196
|
+
calculation: data,
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
return {
|
|
200
|
+
calculation: event.data,
|
|
201
|
+
}
|
|
195
202
|
}
|
|
196
203
|
}),
|
|
197
204
|
setProcessing: assign((context, event) => {
|
|
@@ -239,7 +246,7 @@ export default function (request) {
|
|
|
239
246
|
return await request.send(
|
|
240
247
|
payment.getDepositExpectedResult({
|
|
241
248
|
method,
|
|
242
|
-
amount,
|
|
249
|
+
amount: Number(amount),
|
|
243
250
|
promotionsNo: promotion?.activityNo,
|
|
244
251
|
})
|
|
245
252
|
)
|
|
@@ -287,8 +287,15 @@ export default function (request) {
|
|
|
287
287
|
return { amount: event.data }
|
|
288
288
|
}),
|
|
289
289
|
setCalculation: assign((context, event) => {
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
const { data } = event.data
|
|
291
|
+
if (data) {
|
|
292
|
+
return {
|
|
293
|
+
calculation: data,
|
|
294
|
+
}
|
|
295
|
+
} else {
|
|
296
|
+
return {
|
|
297
|
+
calculation: event.data,
|
|
298
|
+
}
|
|
292
299
|
}
|
|
293
300
|
}),
|
|
294
301
|
clearCalculation: assign((context, event) => {
|
|
@@ -348,7 +355,7 @@ export default function (request) {
|
|
|
348
355
|
return await request.send(
|
|
349
356
|
payment.getDepositExpectedResult({
|
|
350
357
|
method,
|
|
351
|
-
amount,
|
|
358
|
+
amount: Number(amount),
|
|
352
359
|
promotionsNo: promotion?.activityNo,
|
|
353
360
|
})
|
|
354
361
|
)
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -224,14 +224,14 @@ export default function (request) {
|
|
|
224
224
|
},
|
|
225
225
|
MENU_ENTER_GAME: {
|
|
226
226
|
target: 'connectSwitching',
|
|
227
|
-
actions: ['setSwitch', 'setLang'],
|
|
227
|
+
actions: ['setSwitch', 'setLang', 'setWalletType'],
|
|
228
228
|
},
|
|
229
229
|
ENTER_GAME_PAUSE: {
|
|
230
230
|
actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
|
|
231
231
|
},
|
|
232
232
|
ENTER_GAME: {
|
|
233
233
|
target: 'connecting',
|
|
234
|
-
actions: ['setGameInfo', 'setLang', '
|
|
234
|
+
actions: ['setGameInfo', 'setLang', 'setWalletType'],
|
|
235
235
|
},
|
|
236
236
|
},
|
|
237
237
|
},
|
|
@@ -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
|
},
|
package/src/machine/ranking.js
CHANGED
|
@@ -2,6 +2,7 @@ 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
|
|
5
6
|
const cycleMapping = ['DAILY', 'WEEKLY', 'MONTHLY']
|
|
6
7
|
const limit = { DAILY: 56, WEEKLY: 8, MONTHLY: 2, ALL: 2 }
|
|
7
8
|
|
|
@@ -199,7 +200,7 @@ export default function (request) {
|
|
|
199
200
|
},
|
|
200
201
|
fetchRankingOptions: async (context) => {
|
|
201
202
|
const { activityNo } = context
|
|
202
|
-
const { data } = await request.send(ranking.getRankingOptions({ activityNo }))
|
|
203
|
+
const { data } = await request.send(ranking.getRankingOptions({ activityNo, appSecret }))
|
|
203
204
|
return data
|
|
204
205
|
},
|
|
205
206
|
fetchRankingDetail: async (context, event) => {
|
|
@@ -209,7 +210,7 @@ export default function (request) {
|
|
|
209
210
|
},
|
|
210
211
|
fetchRankingGames: async (context) => {
|
|
211
212
|
const { activityNo } = context
|
|
212
|
-
const { data } = await request.send(ranking.getRankingGames({ activityNo }))
|
|
213
|
+
const { data } = await request.send(ranking.getRankingGames({ activityNo, appSecret }))
|
|
213
214
|
return data
|
|
214
215
|
},
|
|
215
216
|
},
|
package/src/machine/vip_table.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import activity from '../api/activity.js'
|
|
3
3
|
export default function (request) {
|
|
4
|
+
const { appSecret } = request.config
|
|
4
5
|
return createMachine(
|
|
5
6
|
{
|
|
6
7
|
id: 'vip_table',
|
|
@@ -35,14 +36,20 @@ export default function (request) {
|
|
|
35
36
|
},
|
|
36
37
|
services: {
|
|
37
38
|
fetchVipTable: async (context, event) => {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const result = await request.send(activity.getVipTable({ appSecret }))
|
|
40
|
+
let dataList = []
|
|
41
|
+
// V2接口轉換中回傳的資料結構不同
|
|
42
|
+
if (!result?.viptable) {
|
|
43
|
+
dataList = result.data
|
|
44
|
+
} else {
|
|
45
|
+
dataList = result.viptable?.data
|
|
46
|
+
}
|
|
47
|
+
dataList.map((item) => {
|
|
41
48
|
item.title = item.title.toLowerCase()
|
|
42
49
|
return item
|
|
43
50
|
})
|
|
44
51
|
|
|
45
|
-
return
|
|
52
|
+
return dataList
|
|
46
53
|
},
|
|
47
54
|
},
|
|
48
55
|
}
|
package/src/request/request.js
CHANGED
|
@@ -2,6 +2,139 @@ import pickBy from 'lodash/pickBy.js'
|
|
|
2
2
|
import storage from '../util/storage.js'
|
|
3
3
|
|
|
4
4
|
// const pickBy = require('lodash/pickBy')
|
|
5
|
+
const supportVersion2List = [
|
|
6
|
+
// 04-09 Update
|
|
7
|
+
'game/play',
|
|
8
|
+
'game/gameReplay',
|
|
9
|
+
'game/logout',
|
|
10
|
+
'game/list/v3/root',
|
|
11
|
+
'game/list/v3/category',
|
|
12
|
+
'game/list/v3/addition',
|
|
13
|
+
'game/list/v3/categoryByRange',
|
|
14
|
+
'game/list/v3/additionByRange',
|
|
15
|
+
'game/list/v3/myFavorite',
|
|
16
|
+
'game/list/v3/addMyFavorite',
|
|
17
|
+
'game/list/v3/removeMyFavorite',
|
|
18
|
+
'login',
|
|
19
|
+
'callback/:strategy',
|
|
20
|
+
'guestLogin',
|
|
21
|
+
'appLogin',
|
|
22
|
+
'logout',
|
|
23
|
+
'self',
|
|
24
|
+
'register',
|
|
25
|
+
'settings/password',
|
|
26
|
+
'verify',
|
|
27
|
+
'reset',
|
|
28
|
+
'acknowledge',
|
|
29
|
+
'recovery',
|
|
30
|
+
'recovery/abandon',
|
|
31
|
+
'recovery/acknowledge',
|
|
32
|
+
'checkDt',
|
|
33
|
+
'updateDt',
|
|
34
|
+
'checkAC',
|
|
35
|
+
'checkAccount',
|
|
36
|
+
'getAllAvatar',
|
|
37
|
+
'updateUserAvatar',
|
|
38
|
+
'getConfig',
|
|
39
|
+
'getQuickLayout',
|
|
40
|
+
'getNavbarSetting',
|
|
41
|
+
'getAffiliateCode',
|
|
42
|
+
'get-site-config',
|
|
43
|
+
'mailbox/sendMessage',
|
|
44
|
+
'mailbox/getMessageList',
|
|
45
|
+
'mailbox/getMessage',
|
|
46
|
+
'mailbox/updateMessage',
|
|
47
|
+
'mailbox/getMessageTypes',
|
|
48
|
+
// 05-23 Update
|
|
49
|
+
'game/info',
|
|
50
|
+
'recovery/v2/initiate',
|
|
51
|
+
'recovery/v2/acknowledge',
|
|
52
|
+
'recovery/v2/abandon',
|
|
53
|
+
'recovery/v2/reset',
|
|
54
|
+
'recovery/v2/changePassword',
|
|
55
|
+
'account-binding/status',
|
|
56
|
+
'account-binding/bind',
|
|
57
|
+
'account-binding/acknowledge',
|
|
58
|
+
'account-binding/bind-third-party',
|
|
59
|
+
'feeds',
|
|
60
|
+
'broadcast',
|
|
61
|
+
'upload',
|
|
62
|
+
'game/search',
|
|
63
|
+
'game/search/home',
|
|
64
|
+
'game/search/list',
|
|
65
|
+
'game/search/trace',
|
|
66
|
+
'game/history',
|
|
67
|
+
'game/history/detail',
|
|
68
|
+
'payment/v2/bankWallet/promotion/apply',
|
|
69
|
+
'payment/v2/bankWallet/promotion/giveUp',
|
|
70
|
+
'payment/v2/bankWallet/promotion/preview',
|
|
71
|
+
'payment/v2/bankWallet/promotions',
|
|
72
|
+
'payment/v2/bankWallet/restore',
|
|
73
|
+
'payment/v2/callback',
|
|
74
|
+
'payment/v2/convertFreeCredit',
|
|
75
|
+
'payment/v2/getBindingBankList',
|
|
76
|
+
'payment/v2/getBindingPaymentList',
|
|
77
|
+
'payment/v2/getWithdrawBankList',
|
|
78
|
+
'payment/v2/getCurrentWithdrawRule',
|
|
79
|
+
'payment/v2/withdrawCheck',
|
|
80
|
+
'payment/v2/history',
|
|
81
|
+
'payment/v2/mergeWallet',
|
|
82
|
+
'payment/v2/paymentDetail',
|
|
83
|
+
'payment/v2/category/options',
|
|
84
|
+
'payment/v2/paymentInfo',
|
|
85
|
+
'payment/v2/getBindingPaymentInfo',
|
|
86
|
+
'payment/v2/pendingOrder',
|
|
87
|
+
'payment/v2/promotions',
|
|
88
|
+
'payment/v2/spotmarket',
|
|
89
|
+
'payment/v2/transactionHistory',
|
|
90
|
+
'payment/v2/updateUtr',
|
|
91
|
+
'payment/v2/setting',
|
|
92
|
+
'payment/v2/amb/setting',
|
|
93
|
+
'payment/v2/updatePaymentInfo',
|
|
94
|
+
'payment/v2/uploadSlip',
|
|
95
|
+
'payment/v2/withdrawRule',
|
|
96
|
+
'payment/v2/:paymentType/getBankList',
|
|
97
|
+
'payment/v2/:paymentType/transaction',
|
|
98
|
+
'payment/v2/:paymentType/checkTransaction',
|
|
99
|
+
'payment/v2/:paymentType/bonus/preview',
|
|
100
|
+
'payment/v2/:paymentType/expected/result',
|
|
101
|
+
'payment/v2/:paymentType/crypto/expected/result',
|
|
102
|
+
// 05-28 Update
|
|
103
|
+
'all-activities/list',
|
|
104
|
+
'activities/list',
|
|
105
|
+
'activities/rewards',
|
|
106
|
+
'activities/rewardAmount',
|
|
107
|
+
'activities/sentAward',
|
|
108
|
+
'activities/exchange',
|
|
109
|
+
'activities/collect',
|
|
110
|
+
'activities',
|
|
111
|
+
'activities/types',
|
|
112
|
+
'activities/promo',
|
|
113
|
+
'activities/viptable',
|
|
114
|
+
'activities/numbers',
|
|
115
|
+
'activities/honorBroadcast',
|
|
116
|
+
'activities/exchange/diamond/max-amount',
|
|
117
|
+
'activities/exchange/diamond/settle',
|
|
118
|
+
'tournament/detail',
|
|
119
|
+
'ranking/detail',
|
|
120
|
+
'ranking/detail/option',
|
|
121
|
+
'hot-game/ranking',
|
|
122
|
+
'activities/getFreeGameReward',
|
|
123
|
+
'activities/getFreeGameRewardList',
|
|
124
|
+
'activities/rebate/estimate',
|
|
125
|
+
'activities/rebate/collect',
|
|
126
|
+
'activities/rebate/history',
|
|
127
|
+
'activities/lose-rebate/history',
|
|
128
|
+
'friends',
|
|
129
|
+
'friends/home',
|
|
130
|
+
'friends/reward-list',
|
|
131
|
+
'friends/dashboard',
|
|
132
|
+
'friends/dashboard/list',
|
|
133
|
+
'activities/ranking',
|
|
134
|
+
'activities/activity/ranking',
|
|
135
|
+
'activities/cashRain',
|
|
136
|
+
'activities/jackpot/list',
|
|
137
|
+
]
|
|
5
138
|
|
|
6
139
|
function isValid(value) {
|
|
7
140
|
return value !== undefined && value !== null
|
|
@@ -16,6 +149,7 @@ export default class Request {
|
|
|
16
149
|
this.key = `cuora_${config.clientId}`
|
|
17
150
|
this.errorHandler = null
|
|
18
151
|
this.hosts = []
|
|
152
|
+
this.isBlocked = false
|
|
19
153
|
this.initialize()
|
|
20
154
|
}
|
|
21
155
|
|
|
@@ -24,7 +158,8 @@ export default class Request {
|
|
|
24
158
|
axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version
|
|
25
159
|
axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform
|
|
26
160
|
if (this.getToken()) {
|
|
27
|
-
|
|
161
|
+
// 為了支援V2版本的API接口新增Bearer來進行身份驗證
|
|
162
|
+
axiosConfig.headers.Authorization = `Bearer ${this.getToken()}`
|
|
28
163
|
}
|
|
29
164
|
return axiosConfig
|
|
30
165
|
})
|
|
@@ -61,10 +196,25 @@ export default class Request {
|
|
|
61
196
|
try {
|
|
62
197
|
const cancelToken = customToken || this.source.token
|
|
63
198
|
this._checkToken(req)
|
|
199
|
+
|
|
64
200
|
const requestConfig = this._createConfig(req, cancelToken)
|
|
65
|
-
|
|
66
|
-
|
|
201
|
+
// console.log('*請求資料Check', requestConfig)
|
|
202
|
+
const configUrls = ['getConfig', 'get-config']
|
|
203
|
+
if (this.isBlocked && !configUrls.includes(requestConfig.url)) {
|
|
204
|
+
// 狀態是維護中&請求非siteConfig,終止所有的請求,除了維護頁需要的資料(siteConfig)
|
|
205
|
+
// console.log('%c*禁止的請求目標', requestConfig)
|
|
206
|
+
} else {
|
|
207
|
+
// console.log('%c*允許的請求目標', requestConfig)
|
|
208
|
+
const { data } = await this.axios.request(requestConfig)
|
|
209
|
+
return data
|
|
210
|
+
}
|
|
67
211
|
} catch (error) {
|
|
212
|
+
if (error.code === 'ERR_F108') {
|
|
213
|
+
console.log('%c*維護中', 'color: #00ff33ff; font-weight: bold;')
|
|
214
|
+
this.isBlocked = true
|
|
215
|
+
this.errorHandler && this.errorHandler(error)
|
|
216
|
+
throw error
|
|
217
|
+
}
|
|
68
218
|
if (error.code !== 'ERR_800') {
|
|
69
219
|
if (error.code) {
|
|
70
220
|
this.errorHandler && this.errorHandler(error)
|
|
@@ -85,11 +235,38 @@ export default class Request {
|
|
|
85
235
|
|
|
86
236
|
_createConfig(req, cancelToken) {
|
|
87
237
|
const { method, url, params, isPublic, isFormData, headers } = req
|
|
238
|
+
let fullURL = this.config.fullURL
|
|
239
|
+
let urlName = url
|
|
240
|
+
// 有些API會將參數(/?)直接帶在URL上,所以要將參數排除
|
|
241
|
+
const cleanUrl = url.split('?')[0]
|
|
242
|
+
|
|
243
|
+
const isV2Supported = supportVersion2List.some((supportedUrl) => {
|
|
244
|
+
// 如果包含動態參數(:parameter),則使用模式匹配
|
|
245
|
+
if (supportedUrl.includes(':')) {
|
|
246
|
+
const pattern = supportedUrl.replace(/:[^/]+/g, '[^/]+')
|
|
247
|
+
const regex = new RegExp(`^${pattern}$`)
|
|
248
|
+
return regex.test(cleanUrl)
|
|
249
|
+
}
|
|
250
|
+
return supportedUrl === cleanUrl
|
|
251
|
+
})
|
|
252
|
+
|
|
253
|
+
// 如果站點是ZAZA,則不支援V2版本的API
|
|
254
|
+
// clientId 可參照各站環境設定檔案
|
|
255
|
+
const supportV2Toggle = ['ZAZA'].includes(this.config?.clientId)
|
|
256
|
+
|
|
257
|
+
if (isV2Supported && !supportV2Toggle) {
|
|
258
|
+
fullURL = fullURL.replace('/v1/', '/v2/')
|
|
259
|
+
urlName = this._convertUrlToKebabCase(url)
|
|
260
|
+
// console.log(`*[DEV_ONLY]V2`, 'url:', urlName)
|
|
261
|
+
} else {
|
|
262
|
+
// console.log(`*[DEV_ONLY]V2-不支援:`, 'url:', urlName)
|
|
263
|
+
}
|
|
264
|
+
|
|
88
265
|
if (isFormData) {
|
|
89
266
|
return {
|
|
90
|
-
baseURL:
|
|
267
|
+
baseURL: fullURL,
|
|
91
268
|
method,
|
|
92
|
-
url,
|
|
269
|
+
url: urlName,
|
|
93
270
|
cancelToken,
|
|
94
271
|
isPublic,
|
|
95
272
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
@@ -97,9 +274,9 @@ export default class Request {
|
|
|
97
274
|
}
|
|
98
275
|
} else {
|
|
99
276
|
return {
|
|
100
|
-
baseURL:
|
|
277
|
+
baseURL: fullURL,
|
|
101
278
|
method,
|
|
102
|
-
url,
|
|
279
|
+
url: urlName,
|
|
103
280
|
cancelToken,
|
|
104
281
|
isPublic,
|
|
105
282
|
headers,
|
|
@@ -108,6 +285,38 @@ export default class Request {
|
|
|
108
285
|
}
|
|
109
286
|
}
|
|
110
287
|
|
|
288
|
+
// 調整API路徑與名稱
|
|
289
|
+
_convertUrlToKebabCase(url) {
|
|
290
|
+
const specifyingPath = {
|
|
291
|
+
'all-activities/list': 'activities/all-activities-list',
|
|
292
|
+
friends: 'activities/friends',
|
|
293
|
+
'friends/home': 'activities/friends/home',
|
|
294
|
+
'friends/reward-list': 'activities/friends/reward-list',
|
|
295
|
+
'friends/dashboard': 'activities/friends/dashboard',
|
|
296
|
+
'friends/dashboard/list': 'activities/friends/dashboard/list',
|
|
297
|
+
'activities/getFreeGameReward': 'activities/free-game/get-free-game-reward',
|
|
298
|
+
'activities/getFreeGameRewardList': 'activities/free-game/get-free-game-reward-list',
|
|
299
|
+
'activities/lose-rebate/history': 'activities/rebate/lose-rebate/history',
|
|
300
|
+
'activities/ranking': 'activities/ranking/promotion-ranking',
|
|
301
|
+
'activities/activity/ranking': 'activities/ranking/basic-ranking',
|
|
302
|
+
'activities/cashRain': 'activities/cash-rain/exchange',
|
|
303
|
+
'tournament/detail': 'activities/tournament/detail',
|
|
304
|
+
'ranking/detail': 'activities/tournament/ranking/detail',
|
|
305
|
+
'ranking/detail/option': 'activities/tournament/ranking/detail/option',
|
|
306
|
+
'hot-game/ranking': 'activities/tournament/ranking/hot-game',
|
|
307
|
+
'activities/rebate/estimate': 'activities/rebate/estimate',
|
|
308
|
+
'activities/exchange/diamond/max-amount': 'activities/diamond/exchange/max-amount',
|
|
309
|
+
'activities/exchange/diamond/settle': 'activities/diamond/exchange/settle',
|
|
310
|
+
}
|
|
311
|
+
if (specifyingPath[url]) {
|
|
312
|
+
// 和原有路徑不同有另外改路徑
|
|
313
|
+
return specifyingPath[url]
|
|
314
|
+
} else {
|
|
315
|
+
// 將API_URL的命名規則由駝峰調整為短橫線(-)
|
|
316
|
+
return url.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
111
320
|
_checkToken(req) {
|
|
112
321
|
if (!req.isPublic && !this.getToken()) {
|
|
113
322
|
throw { code: 'ERR_A103', url: req.url }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
get(name, options) {
|
|
3
|
+
const itemStr = sessionStorage.getItem(name)
|
|
4
|
+
|
|
5
|
+
if (!itemStr) {
|
|
6
|
+
return null
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const item = JSON.parse(itemStr)
|
|
10
|
+
if (item.expiry && new Date().getTime() > item.expiry) {
|
|
11
|
+
sessionStorage.removeItem(name)
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return item.value
|
|
16
|
+
},
|
|
17
|
+
set(name, value, options) {
|
|
18
|
+
const item = { value }
|
|
19
|
+
|
|
20
|
+
if (options?.maxAge) {
|
|
21
|
+
item.expiry = new Date().getTime() + options.maxAge * 1000
|
|
22
|
+
}
|
|
23
|
+
sessionStorage.setItem(name, JSON.stringify(item))
|
|
24
|
+
},
|
|
25
|
+
remove(name, options) {
|
|
26
|
+
sessionStorage.removeItem(name)
|
|
27
|
+
},
|
|
28
|
+
}
|