Commit f70fcbf3 authored by zhaofei's avatar zhaofei

s

parent 85a127e5
......@@ -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,
......
......@@ -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
};
......@@ -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 排序用避免查询乱序
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment