更新军团战力数据

This commit is contained in:
luying
2021-04-09 12:14:28 +08:00
parent a02ee04a5b
commit b9e59202da
4 changed files with 17 additions and 5 deletions
+6 -2
View File
@@ -2,7 +2,7 @@
* 体力系统
*/
import { HERO_SYSTEM_TYPE, ABI_TYPE, HERO_CE_RATIO, HERO_SUB_ATTR_RATIO, LINEUP_NUM } from '../consts';
import { HERO_SYSTEM_TYPE, ABI_TYPE, HERO_CE_RATIO, HERO_SUB_ATTR_RATIO, LINEUP_NUM, REDIS_KEY } from '../consts';
import { deepCopy, getAllAttrStage, reduceCe } from './util';
import { HeroModel, HeroType, HeroUpdate } from '../db/Hero';
@@ -19,6 +19,7 @@ import { PvpDefenseModel } from '../db/PvpDefense';
import { findIndex } from 'underscore';
import { GuildModel } from '../db/Guild';
import { DicJob } from './dictionary/DicJob';
import { redisUserInfoUpdate } from '../services/redisService';
// 修改并下发战力
export async function calPlayerCeAndSave(type: number, roleId: string, originHero: HeroType, update: HeroUpdate, args?: Array<number>) {
@@ -44,7 +45,10 @@ export async function calPlayerCeAndSave(type: number, roleId: string, originHer
role = await RoleModel.updateRoleInfo(roleId, { ce: role.ce + incCe, topLineup, topLineupCe });
await PvpDefenseModel.updateCe(roleId, originHero.hid, heroCe); // 更新pvp防守阵战力
await GuildModel.updateCe(roleId, incCe); // 公会更新战力
let guild = await GuildModel.updateCe(roleId, incCe); // 公会更新战力
if(guild) {
await redisUserInfoUpdate(REDIS_KEY.GUILD_INFO, guild.code, [{ field: 'guildCe', value: guild.guildCe }])
}
let pushHeros = new Array<{ hid: number, ce: number, incHeroCe: number }>();
pushHeros.push({