修改游戏结束的逻辑
This commit is contained in:
parent
bbb80f3314
commit
4f310bf792
@ -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}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user