Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
0bd83d36
Commit
0bd83d36
authored
Dec 01, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:
🐛
卡片状态错误
parent
c2a53dd4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
preCheck.ts
v2.0/src/decorator/common/preCheck.ts
+1
-1
card.service.ts
v2.0/src/service/common/card.service.ts
+2
-2
card.ts
v2.0/src/utils/custom/card.ts
+2
-2
No files found.
v2.0/src/decorator/common/preCheck.ts
View file @
0bd83d36
...
@@ -16,7 +16,7 @@ export default function preCheck(checks: IFunction[]) {
...
@@ -16,7 +16,7 @@ export default function preCheck(checks: IFunction[]) {
for
(
let
i
=
0
;
i
<
checks
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
checks
.
length
;
i
++
)
{
const
checkFn
=
checks
[
i
]
const
checkFn
=
checks
[
i
]
let
result
=
await
checkFn
.
apply
(
target
,
[
context
,
{
...
otherArgs
},
services
,
preCheckData
]
)
let
result
=
await
checkFn
(
context
,
{
...
otherArgs
},
services
,
preCheckData
)
result
=
result
||
{}
result
=
result
||
{}
// 校验报错
// 校验报错
if
((
result
as
IErrorResult
)?.
success
===
false
&&
(
result
as
IErrorResult
)?.
code
)
{
if
((
result
as
IErrorResult
)?.
success
===
false
&&
(
result
as
IErrorResult
)?.
code
)
{
...
...
v2.0/src/service/common/card.service.ts
View file @
0bd83d36
...
@@ -145,12 +145,12 @@ export default class CardService extends UserService {
...
@@ -145,12 +145,12 @@ export default class CardService extends UserService {
prizeDataType
prizeDataType
},
},
{
{
projection
:
{
type
:
1
,
image
:
1
,
prizeDataType
:
1
,
name
:
1
}
projection
:
{
type
:
1
,
image
:
1
,
prizeDataType
:
1
,
name
:
1
,
[
needKey
]:
1
}
}
}
)
)
// 抽奖次数奖池分类 从小到大排列
// 抽奖次数奖池分类 从小到大排列
const
category
=
uniq
(
joinedTimesPrizePool
.
map
(
v
=>
+
v
[
needKey
])).
sort
()
const
category
=
uniq
(
joinedTimesPrizePool
.
map
(
v
=>
+
v
[
needKey
])).
sort
(
(
a
,
b
)
=>
a
-
b
)
const
prizeMapper
=
category
.
reduce
((
prev
,
curr
)
=>
{
const
prizeMapper
=
category
.
reduce
((
prev
,
curr
)
=>
{
return
{
return
{
...
...
v2.0/src/utils/custom/card.ts
View file @
0bd83d36
...
@@ -5,9 +5,9 @@ import { CARD_PRIZE_STATUS } from '../../constants'
...
@@ -5,9 +5,9 @@ import { CARD_PRIZE_STATUS } from '../../constants'
export
function
setCardPrizeStatus
(
joinedTimes
:
number
,
needTimes
:
number
,
joinedTimesAwardList
:
IAwards
[])
{
export
function
setCardPrizeStatus
(
joinedTimes
:
number
,
needTimes
:
number
,
joinedTimesAwardList
:
IAwards
[])
{
if
(
joinedTimes
<
needTimes
)
return
CARD_PRIZE_STATUS
.
LOCK
if
(
joinedTimes
<
needTimes
)
return
CARD_PRIZE_STATUS
.
LOCK
if
(
needTimes
>=
join
edTimes
&&
!
joinedTimesAwardList
.
some
(
v
=>
v
.
needTimes
===
needTimes
))
if
(
joinedTimes
>=
ne
edTimes
&&
!
joinedTimesAwardList
.
some
(
v
=>
v
.
needTimes
===
needTimes
))
return
CARD_PRIZE_STATUS
.
UN_LOCK
return
CARD_PRIZE_STATUS
.
UN_LOCK
if
(
needTimes
>=
join
edTimes
&&
joinedTimesAwardList
.
some
(
v
=>
v
.
needTimes
===
needTimes
))
if
(
joinedTimes
>=
ne
edTimes
&&
joinedTimesAwardList
.
some
(
v
=>
v
.
needTimes
===
needTimes
))
return
CARD_PRIZE_STATUS
.
SUCCESS
return
CARD_PRIZE_STATUS
.
SUCCESS
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment