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
f70fcbf3
Commit
f70fcbf3
authored
Dec 01, 2020
by
zhaofei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s
parent
85a127e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
add.js
client/pages/activity/add/add.js
+2
-2
helper.js
client/utils/helper.js
+25
-1
save.controller.ts
server/duibats/src/controller/save.controller.ts
+2
-2
No files found.
client/pages/activity/add/add.js
View file @
f70fcbf3
...
...
@@ -11,7 +11,7 @@ import {
saveActivityInfo
,
}
from
'/api'
import
{
addFloat
addFloat
,
setPrizeProbalityRange
}
from
'/utils/helper'
const
THANKS_TYPE
=
5
...
...
@@ -222,7 +222,7 @@ Component({
}
=
params
;
let
prizeList
=
[]
<%
for
(
var
i
=
0
;
i
<
activityConfigList
.
length
;
++
i
)
{
%>
<%-
(
!
taskKeys
.
includes
(
activityConfigList
[
i
].
key
)
&&
activityConfigList
[
i
].
sort
==
'prizePool'
)
?
`prizeList = [...prizeList,...
${
activityConfigList
[
i
].
key
}
]`
:
''
%><%
}
%>
<%-
(
!
taskKeys
.
includes
(
activityConfigList
[
i
].
key
)
&&
activityConfigList
[
i
].
sort
==
'prizePool'
)
?
`prizeList = [...prizeList,...
setPrizeProbalityRange(
${
activityConfigList
[
i
].
key
}
)
]`
:
''
%><%
}
%>
return
{
id
,
activityId
,
...
...
client/utils/helper.js
View file @
f70fcbf3
...
...
@@ -131,11 +131,35 @@ const signFigures = function (num, rank = 6) {
}
return
ans
*
sign
;
};
// 概率奖品配置 properiodfrom properiodto
const
setPrizeProbalityRange
=
(
prizes
)
=>
{
let
originPeriod
=
1
return
prizes
.
map
(
v
=>
{
if
(
!
v
.
probability
)
return
v
// 概率为0 跳出10000之外的区间
if
(
+
v
.
probability
===
0
)
return
{
...
v
,
properiodfrom
:
1000000
,
properiodto
:
1000000
}
const
properiodfrom
=
originPeriod
const
properiodto
=
+
originPeriod
+
signFigures
(
+
v
.
probability
*
100
)
-
1
originPeriod
=
+
originPeriod
+
signFigures
(
+
v
.
probability
*
100
)
return
{
...
v
,
properiodfrom
,
properiodto
}
})
}
module
.
exports
=
{
passUrlList
,
signFigures
,
debounce
,
accMul
,
addFloat
,
urlCheck
urlCheck
,
setPrizeProbalityRange
};
server/duibats/src/controller/save.controller.ts
View file @
f70fcbf3
...
...
@@ -51,8 +51,8 @@ export default class ActivitSaveController {
awardReceiveExpiredTime
:
endTime
+
_48_HOURS
}
// 概率奖品配置需要增加 properiodfrom properiodto字段
prizeList
=
activityconfigService
.
setPrizeProbalityRange
(
prizeList
)
// 概率奖品配置需要增加 properiodfrom properiodto字段
-- 改为前端添加(因为多个奖池合并跑下面的方法概率会出问题)
//
prizeList = activityconfigService.setPrizeProbalityRange(prizeList)
// 所有奖品均存在b_prize_config表里, 根据需求定义的奖品参数都要整合到allPrizeLists里
// level 排序用避免查询乱序
...
...
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