寻宝:藏宝图查询
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @Last Modified by: 梁桐川
|
||||
* @Last Modified time: 2020-12-03 21:36:00
|
||||
*/
|
||||
import { IT_TYPE, GOLD_COST_RATIO, CURRENCY_BY_TYPE, CURRENCY_TYPE, COM_TEAM_STATUS, COM_BTL_CONST, GOOD_QUALITY } from './../../../consts/consts';
|
||||
import { IT_TYPE, GOLD_COST_RATIO, CURRENCY_BY_TYPE, CURRENCY_TYPE, COM_TEAM_STATUS, COM_BTL_CONST, GOOD_QUALITY, CONSUME_TYPE } from './../../../consts/consts';
|
||||
import { getGoodById, getBossHpByBlueprtId, getComBtlSetByQuality, getBlueprtComposeByQuality, getBluePrtByQuality, getWarById, getWarIdByBlueprtId } from '../../../pubUtils/gamedata';
|
||||
import { ComBattleTeamModel, BossHp } from '../../../db/ComBattleTeam';
|
||||
import Role, { RoleModel } from '../../../db/Role';
|
||||
@@ -751,6 +751,25 @@ export class ComBattleHandler {
|
||||
return resResult(STATUS.SUCCESS, {teamInfos: teams});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取藏宝图数量
|
||||
* @param {{ids: Array<number>}} msg 藏宝图Id数组,可选参数
|
||||
* @param {BackendSession} session
|
||||
* @returns
|
||||
* @memberof ComBattleHandler
|
||||
*/
|
||||
async getBlueprtCount(msg: {ids: Array<number>}, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let { ids } = msg;
|
||||
let blueprts;
|
||||
if (ids && ids.length) {
|
||||
blueprts = await ItemModel.findbyRoleAndIds(roleId, ids);
|
||||
} else {
|
||||
blueprts = await ItemModel.findByRoleAndType(roleId, CONSUME_TYPE.BLUEPRT);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { blueprts });
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 藏宝图合成
|
||||
* @param {{original: Array<{id: number, count: number}>}} msg
|
||||
|
||||
@@ -26,6 +26,16 @@ export default class Item extends BaseModel {
|
||||
return items;
|
||||
}
|
||||
|
||||
public static async findbyRoleAndIds(roleId: string, ids: Array<number>, lean = true) {
|
||||
const items = await ItemModel.find({ roleId, id: {$in: ids} }).select('id count type').lean(lean);
|
||||
return items;
|
||||
}
|
||||
|
||||
public static async findByRoleAndType(roleId: string, type: number, lean = true) {
|
||||
const items = await ItemModel.find({ roleId, type }).select('id count type').lean(lean);
|
||||
return items;
|
||||
}
|
||||
|
||||
public static async findbyRoleAndGidAndCount(roleId: string, id: number, count: number, lean = true) {
|
||||
const items = await ItemModel.findOne({ roleId, id, count: {$gte: count} }).select('id count type').lean(lean);
|
||||
return items;
|
||||
|
||||
Reference in New Issue
Block a user