抽卡:免费抽卡次数

This commit is contained in:
luying
2022-08-03 11:27:20 +08:00
parent a77304b271
commit e1e9da4a80
7 changed files with 29 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ import { UserGachaType } from '../../db/UserGacha';
import { getTimeFun } from '../../pubUtils/timeUtil';
import { DicGacha } from '../../pubUtils/dictionary/DicGacha';
import { getGachaRemainFloor } from '../../pubUtils/util';
import { RewardInter } from '../../pubUtils/interface';
/**
* @description 保底记录
@@ -47,8 +48,8 @@ export class Turntable {
export class GachaListReturn {
gachaId: number; // dicGacha里的id
gachaType: number;
freeCount: number = 0; // 免费次数
refFreeTime: number = 0; // 免费次数下次刷新时间
isFree: boolean = false; // 免费次数
cost: RewardInter[] = []; // 消耗
count: number = 0; // 整体已抽卡次数
remainFloor: number = 0; // 还剩多少次可以保底
hope: Hope[] = []; // 心愿单
@@ -59,13 +60,10 @@ export class GachaListReturn {
constructor(dicGacha: DicGacha, userGacha: UserGachaType) {
this.gachaId = dicGacha.id;
this.gachaType = dicGacha.gachaType;
this.cost = dicGacha.cost;
if (userGacha) {
this.freeCount = userGacha.freeCount;
if (dicGacha.free.count > 0) {
let f = getTimeFun(userGacha.refFreeTime);
this.refFreeTime = <number>f.getAfterDayWithHour(dicGacha.free.day);
}
this.isFree = userGacha.freeCount < dicGacha.free.count;
this.count = userGacha.count;
this.hope = userGacha.hope;
this.point = userGacha.point;