修改游戏结束的逻辑

This commit is contained in:
zhl 2021-05-06 18:49:30 +08:00
parent bbb80f3314
commit 4f310bf792
2 changed files with 42 additions and 13 deletions

View File

@ -2,16 +2,28 @@ import { dbconn } from '../../decorators/dbconn'
import { import {
getModelForClass, getModelForClass,
modelOptions, modelOptions,
mongoose,
prop prop
} from '@typegoose/typegoose' } from '@typegoose/typegoose'
import { BaseModule } from '../Base' import { BaseModule } from '../Base'
import { noJson } from '../../decorators/nojson' import { noJson } from '../../decorators/nojson'
import { Severity } from '@typegoose/typegoose/lib/internal/constants' import { Severity } from '@typegoose/typegoose/lib/internal/constants'
export class ActivityRewardClass {
@prop()
public rank: number
@prop()
public rankEnd?: number
@prop()
public coupon: string
@prop({default: 0})
public count: number
}
@dbconn() @dbconn()
@modelOptions({schemaOptions: {collection: "shop_activity", timestamps: true}, options: {allowMixed: Severity.ALLOW}}) @modelOptions({schemaOptions: {collection: "shop_activity", timestamps: true}, options: {allowMixed: Severity.ALLOW}})
class ShopActivityClass extends BaseModule { export class ShopActivityClass extends BaseModule {
/** /**
* *
* @type {string} * @type {string}
@ -41,7 +53,7 @@ class ShopActivityClass extends BaseModule {
* *
* @type {number} * @type {number}
*/ */
@prop() @prop({default: 10})
public qcount: number public qcount: number
/** /**
@ -56,11 +68,13 @@ class ShopActivityClass extends BaseModule {
public repeatType: number public repeatType: number
/** /**
* , type有效 * , repeatType有效
* @type {[number]} * @type {[number]}
*/ */
@prop({ type: () => [Number] }) @prop({ type: () => [Number] })
public eventDays: number[] public monthDays: number[]
@prop({ type: () => [Number] })
public weekDays: number[]
/** /**
* , 0 * , 0
* @type {number} * @type {number}
@ -68,15 +82,33 @@ class ShopActivityClass extends BaseModule {
@prop({ type: () => [Number] }) @prop({ type: () => [Number] })
public beginTime: number[] public beginTime: number[]
/** /**
* , * , repeatType为不重复时有效
* @type {number[]}
*/
@prop({type: () => [Number]})
public beginDays: number[]
/**
* ,
* @type {number} * @type {number}
*/ */
@prop() @prop()
public prepareTime: number public prepareTime: number
// TODO: /**
@prop({type: mongoose.Schema.Types.Mixed}) * , repeatType为1,2,3
public rewardInfo: {}; * @type {number}
*/
@prop()
public beginDay: number
/**
* , repeatType为1,2,3
* @type {number}
*/
@prop()
public endDay: number
@prop({_id: false, type: [ActivityRewardClass]})
public rewardInfo: ActivityRewardClass[];
/** /**
* *
* @type {number} * @type {number}

View File

@ -76,10 +76,7 @@ export async function sendOneQuestion(history: any) {
console.log('match over') console.log('match over')
history.status = 9 history.status = 9
await history.save() await history.save()
await endGame(roomId, {}) await endGame(roomId, {closeTime: BaseConst.ROOM_AUTO_CLOSE_TIME})
new Schedule().beginSchedule(BaseConst.ROOM_AUTO_CLOSE_TIME, async function () {
await closeRoom(roomId)
}, history.scheduleKey + '_close')
return return
} }