feat(gift): 增加查询保底进度接口

This commit is contained in:
liangtongchuan
2023-02-18 18:50:44 +08:00
committed by luying
parent 199677e2a4
commit 30562552e7
3 changed files with 39 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import { GiftCodeDetailModel } from "../../../db/GiftCodeDetail";
import { GiftCodeType, GiftCodeModel } from "../../../db/GiftCode";
import { nowSeconds } from "../../../pubUtils/timeUtil";
import { AP } from "../../../pubUtils/dicParam";
import { GiftPackageFloorModel } from "../../../db/GiftPackageFloor";
export default function (app: Application) {
new HandlerService(app, {});
@@ -56,6 +57,31 @@ export class ItemHandler {
}
// 获取礼包保底情况
public async getGiftPackageFloor(msg: { id: number }, session: BackendSession) {
let { id } = msg;
const roleId = session.get('roleId');
let dicGoods = gameData.goods.get(id);
if (!dicGoods) {
return resResult(STATUS.ACTIVITY_DATA_ERROR);
}
let dicItid = ITID.get(dicGoods.itid);
if (!dicItid) return resResult(STATUS.DIC_DATA_NOT_FOUND);
if (dicItid.type != CONSUME_TYPE.GIFT_PACKAGE) {
return resResult(STATUS.NOT_CONSUME_GOODS);
}
let giftID = dicGoods.gift;
if (!giftID) {
return resResult(STATUS.NOT_GIFTPACKAGE);
}
let giftPackageData = gameData.giftPackage.get(giftID);
if (!giftPackageData) {
return resResult(STATUS.NOT_GIFTPACKAGE);
}
let result = await GiftPackageFloorModel.findByGiftPackageId(roleId, giftPackageData.id, 'floors giftPackageId');
return resResult(STATUS.SUCCESS, result);
}
// 使用体力道具
public async useApItem(msg: { id: number, count: number }, session: BackendSession) {
let { id, count } = msg;