@jetthai/cuora 1.1.358-apiv2-1 → 1.1.358-dev-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.
- package/CHANGELOG.md +1 -5
- package/package.json +1 -1
- package/src/machine/game_v2_1.js +0 -3
- package/src/machine/ranking.js +8 -8
- package/src/request/request.js +3 -58
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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.358-
|
|
5
|
+
### [1.1.358-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.358-dev-1) (2025-05-09)
|
|
6
6
|
|
|
7
7
|
### [1.1.358](https://github.com/jetthai/cuora-module/compare/v1.1.357...v1.1.358) (2025-05-09)
|
|
8
8
|
|
|
@@ -10,10 +10,6 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
10
10
|
|
|
11
11
|
### [1.1.356](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.356) (2025-04-29)
|
|
12
12
|
|
|
13
|
-
### [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)
|
|
14
|
-
|
|
15
|
-
### [1.1.355-apiv2-1](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.355-apiv2-1) (2025-05-05)
|
|
16
|
-
|
|
17
13
|
### [1.1.355](https://github.com/jetthai/cuora-module/compare/v1.1.353-data-1...v1.1.355) (2025-04-22)
|
|
18
14
|
|
|
19
15
|
### [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/machine/game_v2_1.js
CHANGED
package/src/machine/ranking.js
CHANGED
|
@@ -4,10 +4,10 @@ import ranking from '../api/ranking.js'
|
|
|
4
4
|
export default function (request) {
|
|
5
5
|
const cycleMapping = ['DAILY', 'WEEKLY', 'MONTHLY']
|
|
6
6
|
|
|
7
|
-
function roundProcess(rounds) {
|
|
7
|
+
function roundProcess(rounds, cycles) {
|
|
8
8
|
const roundArrays = rounds.map((round) => Array.from({ length: round }, (_, i) => i + 1))
|
|
9
9
|
return roundArrays.reduce((acc, roundArray, index) => {
|
|
10
|
-
acc[
|
|
10
|
+
acc[cycles[index]] = roundArray.reverse()
|
|
11
11
|
return acc
|
|
12
12
|
}, {})
|
|
13
13
|
}
|
|
@@ -151,14 +151,14 @@ export default function (request) {
|
|
|
151
151
|
}
|
|
152
152
|
}),
|
|
153
153
|
setRankingOptions: assign((context, event) => {
|
|
154
|
+
const isChampion = event.data?.rule === 'CHAMPION'
|
|
154
155
|
const cycle = event.data?.cycle
|
|
155
156
|
const currentRound = event.data?.currentRound || []
|
|
156
157
|
// 取得結算週期選單列表
|
|
157
|
-
const cycleOptions = cycleMapping.slice(0, currentRound.length)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (cycle === 'MONTHLY') {
|
|
158
|
+
const cycleOptions = isChampion ? cycleMapping.slice(0, currentRound.length) : [cycle]
|
|
159
|
+
const roundOptions = roundProcess(currentRound, cycleOptions)
|
|
160
|
+
// 如果是冠軍龍虎月結算,則加入全部選項
|
|
161
|
+
if (cycle === 'MONTHLY' && isChampion) {
|
|
162
162
|
cycleOptions.push('ALL')
|
|
163
163
|
roundOptions.ALL = roundOptions.MONTHLY
|
|
164
164
|
}
|
|
@@ -166,7 +166,7 @@ export default function (request) {
|
|
|
166
166
|
...event.data,
|
|
167
167
|
options: { cycle: cycleOptions, round: roundOptions },
|
|
168
168
|
// 初始固定顯示 DAILY
|
|
169
|
-
cycle:
|
|
169
|
+
cycle: isChampion ? 'DAILY' : cycle,
|
|
170
170
|
round: currentRound[0],
|
|
171
171
|
}
|
|
172
172
|
}),
|
package/src/request/request.js
CHANGED
|
@@ -2,54 +2,6 @@ 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
|
-
'game/play',
|
|
7
|
-
'game/gameReplay',
|
|
8
|
-
'game/logout',
|
|
9
|
-
'game/list/v3/root',
|
|
10
|
-
'game/list/v3/category',
|
|
11
|
-
'game/list/v3/addition',
|
|
12
|
-
'game/list/v3/categoryByRange',
|
|
13
|
-
'game/list/v3/additionByRange',
|
|
14
|
-
'game/list/v3/myFavorite',
|
|
15
|
-
'game/list/v3/addMyFavorite',
|
|
16
|
-
'game/list/v3/removeMyFavorite',
|
|
17
|
-
'login',
|
|
18
|
-
'callback/:strategy',
|
|
19
|
-
'guestLogin',
|
|
20
|
-
'appLogin',
|
|
21
|
-
'logout',
|
|
22
|
-
'self',
|
|
23
|
-
'register',
|
|
24
|
-
'settings/password',
|
|
25
|
-
'verify',
|
|
26
|
-
'reset',
|
|
27
|
-
'acknowledge',
|
|
28
|
-
'friends',
|
|
29
|
-
'friends/home',
|
|
30
|
-
'friends/reward-list',
|
|
31
|
-
'recovery',
|
|
32
|
-
'recovery/abandon',
|
|
33
|
-
'recovery/acknowledge',
|
|
34
|
-
'checkDt',
|
|
35
|
-
'updateDt',
|
|
36
|
-
'checkAC',
|
|
37
|
-
'checkAccount',
|
|
38
|
-
'getAllAvatar',
|
|
39
|
-
'updateUserAvatar',
|
|
40
|
-
'getConfig',
|
|
41
|
-
'getQuickLayout',
|
|
42
|
-
'getNavbarSetting',
|
|
43
|
-
'getAffiliateCode',
|
|
44
|
-
'get-site-config',
|
|
45
|
-
'friends/dashboard',
|
|
46
|
-
'friends/dashboard/list',
|
|
47
|
-
'mailbox/sendMessage',
|
|
48
|
-
'mailbox/getMessageList',
|
|
49
|
-
'mailbox/getMessage',
|
|
50
|
-
'mailbox/updateMessage',
|
|
51
|
-
'mailbox/getMessageTypes',
|
|
52
|
-
]
|
|
53
5
|
|
|
54
6
|
function isValid(value) {
|
|
55
7
|
return value !== undefined && value !== null
|
|
@@ -72,8 +24,7 @@ export default class Request {
|
|
|
72
24
|
axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version
|
|
73
25
|
axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform
|
|
74
26
|
if (this.getToken()) {
|
|
75
|
-
|
|
76
|
-
axiosConfig.headers.Authorization = `Bearer ${this.getToken()}`
|
|
27
|
+
axiosConfig.headers.Authorization = this.getToken()
|
|
77
28
|
}
|
|
78
29
|
return axiosConfig
|
|
79
30
|
})
|
|
@@ -134,15 +85,9 @@ export default class Request {
|
|
|
134
85
|
|
|
135
86
|
_createConfig(req, cancelToken) {
|
|
136
87
|
const { method, url, params, isPublic, isFormData, headers } = req
|
|
137
|
-
let fullURL = this.config.fullURL
|
|
138
|
-
// 有些API會將參數(/?)直接帶在URL上,所以要將參數排除
|
|
139
|
-
if (supportVersion2List.includes(url.split('?')[0])) {
|
|
140
|
-
console.log('*[DEV_ONLY]有支援V2的API:', url.split('?')[0])
|
|
141
|
-
fullURL = fullURL.replace('/v1/', '/v2/')
|
|
142
|
-
}
|
|
143
88
|
if (isFormData) {
|
|
144
89
|
return {
|
|
145
|
-
baseURL: fullURL,
|
|
90
|
+
baseURL: this.config.fullURL,
|
|
146
91
|
method,
|
|
147
92
|
url,
|
|
148
93
|
cancelToken,
|
|
@@ -152,7 +97,7 @@ export default class Request {
|
|
|
152
97
|
}
|
|
153
98
|
} else {
|
|
154
99
|
return {
|
|
155
|
-
baseURL: fullURL,
|
|
100
|
+
baseURL: this.config.fullURL,
|
|
156
101
|
method,
|
|
157
102
|
url,
|
|
158
103
|
cancelToken,
|