抽卡:添加抽卡接口
This commit is contained in:
@@ -5,6 +5,7 @@ import { UserGachaType } from '../../db/UserGacha';
|
||||
import { getSeconds } from '../../pubUtils/timeUtil';
|
||||
import { DicGacha } from '../../pubUtils/dictionary/DicGacha';
|
||||
import { getFloorStatus } from '../../services/gachaService';
|
||||
import { GACHA_OCCUPY_HID } from '../../consts';
|
||||
|
||||
|
||||
// 抽卡数据
|
||||
@@ -76,7 +77,7 @@ export class GachaListReturn {
|
||||
this.gachaId = dicGacha.id;
|
||||
|
||||
if(userGacha) {
|
||||
this.freeCount = dicGacha.free.count - userGacha.freeCount;
|
||||
this.freeCount = userGacha.freeCount;
|
||||
this.refFreeTime = getSeconds(userGacha.refFreeTime);
|
||||
this.count = userGacha.count;
|
||||
this.floor = getFloorStatus(dicGacha.id, userGacha.floor);
|
||||
@@ -88,4 +89,43 @@ export class GachaListReturn {
|
||||
this.floor = getFloorStatus(dicGacha.id, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class GachaResult {
|
||||
@prop({ required: true })
|
||||
contentId: number; // 抽卡内容id
|
||||
@prop({ required: true })
|
||||
hid: number = 0; // 武将id
|
||||
@prop({ required: true })
|
||||
isTransfer: boolean = false; // 是否转换为碎片
|
||||
@prop({ required: true })
|
||||
id: number = 0; // 道具id
|
||||
@prop({ required: true })
|
||||
count: number = 0; // 道具数量
|
||||
|
||||
constructor(contentId: number) {
|
||||
this.contentId = contentId;
|
||||
}
|
||||
|
||||
setSetPickHero(hid: number) {
|
||||
if(hid > 0 && this.hid == GACHA_OCCUPY_HID) {
|
||||
this.hid = hid;
|
||||
}
|
||||
}
|
||||
|
||||
setHero(hid: number) {
|
||||
this.hid = hid;
|
||||
this.count = 1;
|
||||
}
|
||||
|
||||
setItem(id: number, count: number) {
|
||||
this.id = id;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
transferToPiece(id: number, count: number) {
|
||||
this.isTransfer = true;
|
||||
this.id = id;
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user