@jetthai/cuora 1.1.343-dev-9 → 1.1.343-dev-10
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 +12 -0
- package/package.json +1 -1
- package/src/machine/activity/vip_card_activity.js +67 -28
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
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.343-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.344-vipCardPro-3...v1.1.343-dev-10) (2025-03-27)
|
|
6
|
+
|
|
7
|
+
### [1.1.343-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.344...v1.1.343-dev-9) (2025-03-18)
|
|
8
|
+
|
|
9
|
+
### [1.1.343-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.343-dev-7...v1.1.343-dev-8) (2025-03-18)
|
|
10
|
+
|
|
11
|
+
### [1.1.343-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.343-dev-6...v1.1.343-dev-7) (2025-03-17)
|
|
12
|
+
|
|
13
|
+
### [1.1.343-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.343-dev-5...v1.1.343-dev-6) (2025-03-17)
|
|
14
|
+
|
|
15
|
+
### [1.1.343-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.343-depositEvent-1...v1.1.343-dev-5) (2025-03-14)
|
|
16
|
+
|
|
5
17
|
### [1.1.343-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.343-dev-8...v1.1.343-dev-9) (2025-03-18)
|
|
6
18
|
|
|
7
19
|
### [1.1.343-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.343-dev-7...v1.1.343-dev-8) (2025-03-18)
|
package/package.json
CHANGED
|
@@ -11,17 +11,19 @@ export default function (request) {
|
|
|
11
11
|
activityDetail: null,
|
|
12
12
|
conditions: null,
|
|
13
13
|
rebateType: null,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
nextCycleCardCurrentReachLevel: null,
|
|
15
|
+
nextCycleCardNextReachLevel: null,
|
|
16
|
+
lastCycleCard: null,
|
|
17
17
|
nextDepositLimit: null,
|
|
18
18
|
nextTurnoverLimit: null,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
accumulateTotalDeposit: null,
|
|
20
|
+
accumulateTotalValidTurnover: null,
|
|
21
21
|
retainAmount: '0',
|
|
22
|
-
|
|
22
|
+
yesterdayRewardsAmount: '0',
|
|
23
23
|
calculateWalletMode: '1',
|
|
24
24
|
duration: 0,
|
|
25
|
+
isAccumulationPeriod: false, // 當前是否為累積期
|
|
26
|
+
isAwardPeriod: false, // 當前是否為領獎期
|
|
25
27
|
},
|
|
26
28
|
initial: 'idle',
|
|
27
29
|
states: {
|
|
@@ -45,6 +47,17 @@ export default function (request) {
|
|
|
45
47
|
},
|
|
46
48
|
},
|
|
47
49
|
},
|
|
50
|
+
sentAward: {
|
|
51
|
+
invoke: {
|
|
52
|
+
src: 'sentAward',
|
|
53
|
+
onDone: {
|
|
54
|
+
target: 'loading',
|
|
55
|
+
},
|
|
56
|
+
onError: {
|
|
57
|
+
target: 'loaded',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
48
61
|
loaded: {
|
|
49
62
|
entry: 'setDuration',
|
|
50
63
|
after: {
|
|
@@ -61,6 +74,9 @@ export default function (request) {
|
|
|
61
74
|
STOP: {
|
|
62
75
|
target: '.idle',
|
|
63
76
|
},
|
|
77
|
+
SENT_AWARD: {
|
|
78
|
+
target: '.sentAward',
|
|
79
|
+
},
|
|
64
80
|
},
|
|
65
81
|
},
|
|
66
82
|
{
|
|
@@ -79,50 +95,68 @@ export default function (request) {
|
|
|
79
95
|
const {
|
|
80
96
|
rebateType,
|
|
81
97
|
conditions = [],
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
nextCycleCardCurrentReachLevel = {},
|
|
99
|
+
nextCycleCardNextReachLevel = {},
|
|
100
|
+
lastCycleCard = {},
|
|
101
|
+
accumulateTotalDeposit = '0',
|
|
102
|
+
accumulateTotalValidTurnover = '0',
|
|
87
103
|
retainAmount = '0',
|
|
88
|
-
|
|
104
|
+
yesterdayRewardsAmount = '0',
|
|
89
105
|
calculateWalletMode = '0',
|
|
106
|
+
accumulateStartTime,
|
|
107
|
+
accumulateEndTime,
|
|
108
|
+
lastCycleCardStartTime,
|
|
109
|
+
lastCycleCardEndTime,
|
|
90
110
|
} = context.activityDetail || {}
|
|
91
111
|
|
|
92
112
|
let nextDepositLimit = '0'
|
|
93
113
|
let nextTurnoverLimit = '0'
|
|
94
114
|
let currentTurnover = '0'
|
|
95
115
|
let currentDeposit = '0'
|
|
116
|
+
const maxReachLevel = conditions?.[conditions?.length - 1]
|
|
96
117
|
// 若已達到最高等級,所有數值皆以最高等級顯示
|
|
97
|
-
if (
|
|
98
|
-
currentDeposit =
|
|
99
|
-
currentTurnover =
|
|
100
|
-
nextDepositLimit =
|
|
101
|
-
nextTurnoverLimit =
|
|
118
|
+
if (maxReachLevel && nextCycleCardCurrentReachLevel?.title === maxReachLevel.title) {
|
|
119
|
+
currentDeposit = maxReachLevel.depositLimit
|
|
120
|
+
currentTurnover = maxReachLevel.turnoverLimit
|
|
121
|
+
nextDepositLimit = maxReachLevel.depositLimit
|
|
122
|
+
nextTurnoverLimit = maxReachLevel.turnoverLimit
|
|
102
123
|
} else {
|
|
103
|
-
currentDeposit =
|
|
104
|
-
currentTurnover =
|
|
105
|
-
nextDepositLimit =
|
|
106
|
-
nextTurnoverLimit =
|
|
124
|
+
currentDeposit = accumulateTotalDeposit
|
|
125
|
+
currentTurnover = accumulateTotalValidTurnover
|
|
126
|
+
nextDepositLimit = nextCycleCardNextReachLevel?.depositLimit
|
|
127
|
+
nextTurnoverLimit = nextCycleCardNextReachLevel?.turnoverLimit
|
|
107
128
|
}
|
|
129
|
+
// 計算當前是否為累積期及領獎期
|
|
130
|
+
const currentTime = new Date().getTime() / 1000
|
|
131
|
+
const isAccumulationPeriod = currentTime >= accumulateStartTime && currentTime <= accumulateEndTime
|
|
132
|
+
const isAwardPeriod = currentTime >= lastCycleCardStartTime && currentTime <= lastCycleCardEndTime
|
|
108
133
|
|
|
109
134
|
return {
|
|
110
135
|
rebateType,
|
|
111
136
|
conditions,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
137
|
+
nextCycleCardCurrentReachLevel,
|
|
138
|
+
nextCycleCardNextReachLevel,
|
|
139
|
+
lastCycleCard,
|
|
115
140
|
nextDepositLimit,
|
|
116
141
|
nextTurnoverLimit,
|
|
117
|
-
|
|
118
|
-
|
|
142
|
+
accumulateTotalDeposit: currentDeposit,
|
|
143
|
+
accumulateTotalValidTurnover: currentTurnover,
|
|
119
144
|
retainAmount,
|
|
120
|
-
|
|
145
|
+
yesterdayRewardsAmount,
|
|
121
146
|
calculateWalletMode,
|
|
147
|
+
isAccumulationPeriod,
|
|
148
|
+
isAwardPeriod,
|
|
122
149
|
}
|
|
123
150
|
}),
|
|
124
151
|
setDuration: assign((context, event) => {
|
|
125
|
-
const {
|
|
152
|
+
const { rewardPeriodSameAsAccumulationPeriod, accumulateEndTime, lastCycleCardEndTime } = context?.activityDetail
|
|
153
|
+
const { isAwardPeriod } = context
|
|
154
|
+
// 若為累積期,則倒數時間以累積期結束時間計算
|
|
155
|
+
let currentEndTime = accumulateEndTime
|
|
156
|
+
// 若為領獎期,則倒數時間以領獎期結束時間計算
|
|
157
|
+
if (!rewardPeriodSameAsAccumulationPeriod && isAwardPeriod) {
|
|
158
|
+
currentEndTime = lastCycleCardEndTime
|
|
159
|
+
}
|
|
126
160
|
return {
|
|
127
161
|
duration: Math.max(parseInt(currentEndTime) - new Date().getTime() / 1000, 0),
|
|
128
162
|
}
|
|
@@ -134,6 +168,11 @@ export default function (request) {
|
|
|
134
168
|
const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
|
|
135
169
|
return data
|
|
136
170
|
},
|
|
171
|
+
sentAward: async (context, event) => {
|
|
172
|
+
const { activityNo } = context
|
|
173
|
+
const { data } = await request.send(api.sentAward({ activityNo, appSecret }))
|
|
174
|
+
return data
|
|
175
|
+
},
|
|
137
176
|
},
|
|
138
177
|
}
|
|
139
178
|
)
|