Commit 930d9bf9 authored by zhaofei's avatar zhaofei

修改模板

parent 015cbf59
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import { BaseDao } from '../sdk' import { BaseDao } from '../sdk'
import { ACTIVITY_CONFIG_DB_NAME, PRIZE_CONFIG_DB_NAME } from '../db' 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' import { signFigures } from '../utils'
export default class ActivityConfigService { export default class ActivityConfigService {
...@@ -122,7 +122,7 @@ export default class ActivityConfigService { ...@@ -122,7 +122,7 @@ export default class ActivityConfigService {
if (allPrizeList[i].switchStock === STOCK_TYPE.NO_LIMIT) { if (allPrizeList[i].switchStock === STOCK_TYPE.NO_LIMIT) {
allPrizeList[i].useStock = 0; allPrizeList[i].useStock = 0;
} else if (allPrizeList[i].switchStock === STOCK_TYPE.LIMIT) { } 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]) const editResult = await this.updateOnePrizeById(allPrizeList[i]._id, allPrizeList[i])
if (editResult) { if (editResult) {
...@@ -138,7 +138,7 @@ export default class ActivityConfigService { ...@@ -138,7 +138,7 @@ export default class ActivityConfigService {
// 更新单条数据 // 更新单条数据
async updateOnePrizeById(id, data: IActivityPrize) { async updateOnePrizeById(id, data: IActivityPrize) {
if (data.switchStock === STOCK_TYPE.NO_LIMIT) { if(data.switchStock === STOCK_TYPE.NO_LIMIT) {
data.useStock = 0 data.useStock = 0
} else { } else {
delete data.useStock delete data.useStock
...@@ -162,7 +162,7 @@ export default class ActivityConfigService { ...@@ -162,7 +162,7 @@ export default class ActivityConfigService {
return await this.activityconfigPrizeDao.insertOne({ return await this.activityconfigPrizeDao.insertOne({
...data, ...data,
activityId, activityId,
useStock: 0, useStock:0,
createTime: Date.now(), createTime: Date.now(),
updateTime: Date.now(), updateTime: Date.now(),
deleteStatus: DELETE_STATUS.EXIST deleteStatus: DELETE_STATUS.EXIST
...@@ -414,27 +414,11 @@ export default class ActivityConfigService { ...@@ -414,27 +414,11 @@ export default class ActivityConfigService {
* @memberof ActivityConfigService * @memberof ActivityConfigService
*/ */
formatPrizeConfig(prizeConfig: Array<IActivityPrize>) { formatPrizeConfig(prizeConfig: Array<IActivityPrize>) {
// level 根据level排序 // level 根据level排序
let prizeList = prizeConfig.sort((a, b) => a.level - b.level) let prizeList = prizeConfig.sort((a,b) => a.level - b.level)
const poolConfig = <% - JSON.stringify(activityConfigList) %> 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 return prizeData
} }
......
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