活动:添加抽卡数据类型
This commit is contained in:
23
shared/domain/activityField/gachaField.ts
Normal file
23
shared/domain/activityField/gachaField.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { prop } from '@typegoose/typegoose';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
|
||||
// 抽卡数据
|
||||
export class GachaData extends ActivityBase {
|
||||
@prop({ required: true })
|
||||
gachaId: number = 0;
|
||||
@prop({ required: true })
|
||||
heroes: Array<number> = [];
|
||||
|
||||
|
||||
public initData(data: string) {
|
||||
let obj = JSON.parse(data);
|
||||
this.gachaId = obj.gachaId;
|
||||
this.heroes = obj.heroes;
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType) {
|
||||
super(activityData)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user