战力:修复bug

This commit is contained in:
luying
2022-03-30 18:01:03 +08:00
parent 9adbd08d3c
commit 83dc974632
10 changed files with 2994 additions and 2844 deletions

View File

@@ -1,12 +1,11 @@
import { UserModel } from '@db/User';
import { CeAttrDataRole, RoleModel } from '@db/Role';
import { RoleModel } from '@db/Role';
import { HeroModel } from '@db/Hero';
import { Service } from 'egg';
import { STATUS, REDIS_KEY, WAR_TYPE } from '@consts';
import { ItemModel } from '@db/Item';
import { gameData } from '@pubUtils/data';
import { AttributeCal } from '@domain/roleField/attribute';
import { smsModel } from '@db/Sms';
import { isString } from 'underscore';
import { GiftCodeModel } from '@db/GiftCode';
@@ -22,6 +21,7 @@ import { RedisClient } from 'redis';
import { UserGuildModel } from '@db/UserGuild';
import { TowerRecordModel } from '@db/TowerRecord';
import { nowSeconds } from '@pubUtils/timeUtil';
import { RoleCeModel, RoleCeType } from '@db/RoleCe';
// import { resResult } from '@pubUtils/util';
@@ -295,18 +295,18 @@ export default class GMUsers extends Service {
const heroes = await HeroModel.findByCondition(page, pageSize, sortField, sortOrder, form);
const total = await HeroModel.countByCondition( form )
let roleMap = new Map<string, CeAttrDataRole[]>();
let roleMap = new Map<string, RoleCeType>();
for(let { roleId } of heroes) {
if(!roleMap.has(roleId)) {
let role = await RoleModel.findByRoleId(roleId, 'attr');
roleMap.set(roleId, role.attr);
let roleCe = await RoleCeModel.findByRoleId(roleId);
roleMap.set(roleId, roleCe);
}
}
let list = heroes.map(cur => {
let cal = new AttributeCal();
cal.setByDbData(roleMap.get(cur.roleId), cur.attr);
return {...cur, calculatedAttr: cal.getAttributesToArr(), env: ctx.app.config.realEnv}
let roleCe = roleMap.get(cur.roleId);
let attr = roleCe.attributes.filter(ccur => ccur.hid == cur.hid);
return {...cur, calculatedAttr: attr, env: ctx.app.config.realEnv}
})
return ctx.service.utils.resResult(STATUS.SUCCESS, { list, total })