Commit 0bf31793 authored by maggie's avatar maggie

排行榜开奖

parent 3ea93a86
...@@ -559,6 +559,37 @@ ...@@ -559,6 +559,37 @@
"return": true "return": true
} }
] ]
},
"endOfActivityRewards": {
"desc": "排行榜开奖",
"decorators": [
{
"type": "common",
"name": "noCheckUser"
}
],
"main": [
{
"type": "common",
"service": "base",
"function": "getNeedRewardsActivityList",
"params": [],
"return": false
},
{
"type": "common",
"service": "awards",
"function": "openPrize",
"params": [
{ "type": "var", "value": "commonBaseGetNeedRewardsActivityListResult1" },
{ "type": "var", "value": 1 },
{ "value": "sortKey" },
{ "value": "sortTimeKey" },
{ "type": "var", "value": 200 }
],
"return": true
}
]
} }
}, },
"share": { "share": {
......
...@@ -109,7 +109,6 @@ export enum STAT_TYPE { ...@@ -109,7 +109,6 @@ export enum STAT_TYPE {
INITE_SUCCESS INITE_SUCCESS
} }
// 每次参与消耗次数 // 每次参与消耗次数
export const JOIN_NEED_TIMES = 1 export const JOIN_NEED_TIMES = 1
......
...@@ -103,19 +103,15 @@ export default class AwardsController { ...@@ -103,19 +103,15 @@ export default class AwardsController {
[commonBaseService, commonAwardsService]: [CommonBaseService, CommonAwardsService] [commonBaseService, commonAwardsService]: [CommonBaseService, CommonAwardsService]
) { ) {
const activityList = await commonBaseService.getNeedRewardsActivityList() const activityList = await commonBaseService.getNeedRewardsActivityList()
const fail = [] const openResult = await commonAwardsService.openPrize(
const success = [] activityList,
for (let activity of activityList) { PRIZE_DATA_TYPE.RANKING,
const res = await commonAwardsService.openPrize(activity, PRIZE_DATA_TYPE.RANKING, 'sortKey', 'sortTimeKey', 200) 'sortKey',
if (res) { 'sortTimeKey',
success.push(activity._id) 200
} else { )
fail.push(activity._id)
}
}
return resultsModel.success({ return resultsModel.success({
fail, ...openResult
success
}) })
} }
} }
/** @format */ /** @format */
import { services, checkParams, preCheck, registeInfos } from '../../decorator/common' import { services, checkParams, preCheck, registeInfos, noCheckUser } from '../../decorator/common'
import { import {
checkPrizeExpired, checkPrizeExpired,
checkValidObjectPrize, checkValidObjectPrize,
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
} from '../../utils/common/check' } from '../../utils/common/check'
import customUtil from '../../utils/custom' import customUtil from '../../utils/custom'
import { resultsModel } from '../../sdk' import { resultsModel } from '../../sdk'
import { CommonAwardsService } from '../../service/common' import { CommonAwardsService, CommonBaseService } from '../../service/common'
export default class AwardsController { export default class AwardsController {
/** /**
...@@ -86,4 +86,26 @@ export default class AwardsController { ...@@ -86,4 +86,26 @@ export default class AwardsController {
...commonAwardsDrawLotteryResult1 ...commonAwardsDrawLotteryResult1
}) })
} }
/**
* 排行榜开奖
*/
@noCheckUser
@services([CommonBaseService, CommonAwardsService])
async endOfActivityRewards(
context: IContext<IParams>,
{ activityInfo, userInfo }: IControllerInfos,
[commonBaseService, commonAwardsService]: [CommonBaseService, CommonAwardsService]
) {
const commonBaseGetNeedRewardsActivityListResult1 = await commonBaseService.getNeedRewardsActivityList()
const commonAwardsOpenPrizeResult2 = await commonAwardsService.openPrize(
commonBaseGetNeedRewardsActivityListResult1,
1,
'sortKey',
'sortTimeKey',
200
)
return resultsModel.success({
...commonAwardsOpenPrizeResult2
})
}
} }
...@@ -33,6 +33,7 @@ export default { ...@@ -33,6 +33,7 @@ export default {
receiveObjectPrize: CommonAwardsControllerInstance.receiveObjectPrize, receiveObjectPrize: CommonAwardsControllerInstance.receiveObjectPrize,
receiveEnamePrize: CommonAwardsControllerInstance.receiveEnamePrize, receiveEnamePrize: CommonAwardsControllerInstance.receiveEnamePrize,
drawLotteryPrize: CommonAwardsControllerInstance.drawLotteryPrize, drawLotteryPrize: CommonAwardsControllerInstance.drawLotteryPrize,
endOfActivityRewards: CommonAwardsControllerInstance.endOfActivityRewards,
getShareInfo: CommonShareControllerInstance.getShareInfo, getShareInfo: CommonShareControllerInstance.getShareInfo,
doHelp: CommonShareControllerInstance.doHelp, doHelp: CommonShareControllerInstance.doHelp,
testAddStat: CustomTest1ControllerInstance.testAddStat, testAddStat: CustomTest1ControllerInstance.testAddStat,
......
...@@ -325,7 +325,10 @@ export default class AwardsService extends UserService { ...@@ -325,7 +325,10 @@ export default class AwardsService extends UserService {
* @param sortTimeKey * @param sortTimeKey
* @param limit * @param limit
*/ */
async openPrize(activityInfo, prizeDataType, sortKey: string, sortTimeKey: string, limit?: number) { async openPrize(activityList, prizeDataType, sortKey: string, sortTimeKey: string, limit?: number) {
const fail = []
const success = []
for (let activityInfo of activityList) {
const { _id } = activityInfo const { _id } = activityInfo
await this.activitydao.update({ _id }, { $set: { openPrizeStatus: ACTIVITY_OPEN_PRIZE_STATUS.OPENING } }) await this.activitydao.update({ _id }, { $set: { openPrizeStatus: ACTIVITY_OPEN_PRIZE_STATUS.OPENING } })
const prizeConfigList = await this.getPrizeConfig({ const prizeConfigList = await this.getPrizeConfig({
...@@ -375,10 +378,12 @@ export default class AwardsService extends UserService { ...@@ -375,10 +378,12 @@ export default class AwardsService extends UserService {
} }
if (result) { if (result) {
await this.activitydao.update({ _id }, { $set: { openPrizeStatus: ACTIVITY_OPEN_PRIZE_STATUS.SUCCESS } }) await this.activitydao.update({ _id }, { $set: { openPrizeStatus: ACTIVITY_OPEN_PRIZE_STATUS.SUCCESS } })
return true success.push(_id)
} else { } else {
await this.activitydao.update({ _id }, { $set: { openPrizeStatus: ACTIVITY_OPEN_PRIZE_STATUS.FAIL } }) await this.activitydao.update({ _id }, { $set: { openPrizeStatus: ACTIVITY_OPEN_PRIZE_STATUS.FAIL } })
return false fail.push(_id)
} }
} }
return { success, fail }
}
} }
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
type IActivityInfo = ICommonActivityInfo & ICustomActivityInfo type IActivityInfo = ICommonActivityInfo & ICustomActivityInfo
interface ICustomActivityInfo { interface ICustomActivityInfo {}
}
interface ICommonActivityInfo { interface ICommonActivityInfo {
_id?: string _id?: string
id?: string id?: string
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
type IAwards = ICommonAwards & ICustomAwards type IAwards = ICommonAwards & ICustomAwards
interface ICustomAwards { interface ICustomAwards {}
}
interface ICommonAwards { interface ICommonAwards {
_id?: string _id?: string
id?: string id?: string
......
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