抽卡:新武将抽卡接入
This commit is contained in:
@@ -32,6 +32,8 @@ export default class Activity_New_Hero_Gacha extends BaseModel {
|
||||
count: number; // 抽卡次数,抽中大奖后重新统计
|
||||
@prop({ required: true })
|
||||
records: Record[]; // 抽卡历史记录
|
||||
@prop({ required: true })
|
||||
hasGetFloor: boolean; // 是否抽到保底了
|
||||
|
||||
//重置统计次数
|
||||
public static async resetCount(serverId: number, activityId: number, roleId: string, count: number) {
|
||||
@@ -43,7 +45,7 @@ export default class Activity_New_Hero_Gacha extends BaseModel {
|
||||
//抽卡记录
|
||||
public static async addRecord(serverId: number, activityId: number, roleId: string, hid: number, count: number, reward: string, hasGetFloor: boolean) {
|
||||
let result: ActivityNewHeroGachaModelType = await ActivityNewHeroGachaModel.findOneAndUpdate({ serverId, roleId, activityId },
|
||||
{ $inc: { count }, $push: { records: { hid, count, reward, time: new Date(), hasGetFloor } } }, { upsert: true, new: true }).lean(true);
|
||||
{ $set: { count, hasGetFloor }, $push: { records: { hid, count, reward, time: new Date(), hasGetFloor } } }, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ export class NewHeroGachaItem {
|
||||
selected: boolean = false;//选中武将
|
||||
floorCount: number = 0;//保底最大的次数,一定会出现一次
|
||||
count: number = 0;//多少次没有抽中
|
||||
hasGetFloor: boolean = false; // 是否有抽到保底,伪随机算法,抽到后未到保底次数强制不给
|
||||
hid: number = 0;//武将id
|
||||
name: string = '';//名字
|
||||
cost: RewardInter[];//每次抽卡消耗资源
|
||||
@@ -57,6 +58,7 @@ export class NewHeroGachaData extends ActivityBase {
|
||||
}
|
||||
for (let item of this.list) {
|
||||
item.count = data.count ? data.count : 0;
|
||||
item.hasGetFloor = data.hasGetFloor||false;
|
||||
item.selected = (data && data.selectedHid == item.hid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user