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
930d9bf9
Commit
930d9bf9
authored
Nov 10, 2020
by
zhaofei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改模板
parent
015cbf59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
24 deletions
+8
-24
activityconfig.service.ts
server/duibats/src/service/activityconfig.service.ts
+8
-24
No files found.
server/duibats/src/service/activityconfig.service.ts
View file @
930d9bf9
...
...
@@ -3,7 +3,7 @@
import
{
BaseDao
}
from
'../sdk'
import
{
ACTIVITY_CONFIG_DB_NAME
,
PRIZE_CONFIG_DB_NAME
}
from
'../db'
import
{
DELETE_STATUS
,
OPEN_PRIZE_STATUS
,
PRIZE_TYPE
,
STOCK_TYPE
}
from
'../constants'
import
{
DELETE_STATUS
,
OPEN_PRIZE_STATUS
,
PRIZE_TYPE
,
STOCK_TYPE
}
from
'../constants'
import
{
signFigures
}
from
'../utils'
export
default
class
ActivityConfigService
{
...
...
@@ -122,7 +122,7 @@ export default class ActivityConfigService {
if
(
allPrizeList
[
i
].
switchStock
===
STOCK_TYPE
.
NO_LIMIT
)
{
allPrizeList
[
i
].
useStock
=
0
;
}
else
if
(
allPrizeList
[
i
].
switchStock
===
STOCK_TYPE
.
LIMIT
)
{
(
allPrizeList
[
i
].
useStock
||
allPrizeList
[
i
].
useStock
===
0
)
&&
delete
allPrizeList
[
i
].
useStock
;
(
allPrizeList
[
i
].
useStock
||
allPrizeList
[
i
].
useStock
===
0
)
&&
delete
allPrizeList
[
i
].
useStock
;
}
const
editResult
=
await
this
.
updateOnePrizeById
(
allPrizeList
[
i
].
_id
,
allPrizeList
[
i
])
if
(
editResult
)
{
...
...
@@ -138,7 +138,7 @@ export default class ActivityConfigService {
// 更新单条数据
async
updateOnePrizeById
(
id
,
data
:
IActivityPrize
)
{
if
(
data
.
switchStock
===
STOCK_TYPE
.
NO_LIMIT
)
{
if
(
data
.
switchStock
===
STOCK_TYPE
.
NO_LIMIT
)
{
data
.
useStock
=
0
}
else
{
delete
data
.
useStock
...
...
@@ -162,7 +162,7 @@ export default class ActivityConfigService {
return
await
this
.
activityconfigPrizeDao
.
insertOne
({
...
data
,
activityId
,
useStock
:
0
,
useStock
:
0
,
createTime
:
Date
.
now
(),
updateTime
:
Date
.
now
(),
deleteStatus
:
DELETE_STATUS
.
EXIST
...
...
@@ -414,27 +414,11 @@ export default class ActivityConfigService {
* @memberof ActivityConfigService
*/
formatPrizeConfig
(
prizeConfig
:
Array
<
IActivityPrize
>
)
{
// level 根据level排序
let
prizeList
=
prizeConfig
.
sort
((
a
,
b
)
=>
a
.
level
-
b
.
level
)
const
poolConfig
=
<%
-
JSON
.
stringify
(
activityConfigList
)
%>
// level 根据level排序
let
prizeList
=
prizeConfig
.
sort
((
a
,
b
)
=>
a
.
level
-
b
.
level
)
const
poolConfig
=
<%
-
JSON
.
stringify
(
activityConfigList
)
%>
// 取出奖池种类
let
prizeData
=
{}
poolConfig
.
forEach
(
item
=>
{
prizeData
[
item
.
key
]
=
prizeList
.
filter
(
prize
=>
{
return
+
item
.
prizeDataType
==
+
prize
.
prizeDataType
})
});
// 过滤奖池内条件
poolConfig
.
forEach
(
item
=>
{
if
(
item
.
conditionKeys
?.
length
)
{
item
.
conditionKeys
.
forEach
(
condition
=>
{
prizeData
[
item
.
key
].
filter
(
prize
=>
{
return
prize
[
condition
.
key
]
==
condition
.
value
})
})
}
})
return
prizeData
}
...
...
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