后台:属性显示
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { UserModel } from '@db/User';
|
||||
import { RoleModel } from '@db/Role';
|
||||
import { CeAttrDataRole, RoleModel } from '@db/Role';
|
||||
import { HeroModel } from '@db/Hero';
|
||||
import { EquipModel } from '@db/Equip';
|
||||
import { ActionPointModel } from '@db/ActionPoint';
|
||||
@@ -503,8 +503,20 @@ export default class GMUsers extends Service {
|
||||
let heroes = await HeroModel.findByField(field, value);
|
||||
|
||||
if (heroes) {
|
||||
let roleMap = new Map<string, CeAttrDataRole[]>();
|
||||
for(let { roleId } of heroes) {
|
||||
if(!roleMap.has(roleId)) {
|
||||
let role = await RoleModel.findByRoleId(roleId, 'attr');
|
||||
roleMap.set(roleId, role.attr);
|
||||
}
|
||||
}
|
||||
let list = heroes.map(cur => {
|
||||
let cal = new AttributeCal();
|
||||
cal.setByDbData(roleMap.get(cur.roleId), cur.attr);
|
||||
return {...cur, calculatedAttr: cal.getReduceAttributesToArr()}
|
||||
})
|
||||
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, { list: heroes });
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, { list });
|
||||
} else {
|
||||
console.error('role list not found');
|
||||
return ctx.service.utils.resResult(STATUS.INTERNAL_ERR);
|
||||
|
||||
Reference in New Issue
Block a user