日志:增加日志详述,方便后台读取

This commit is contained in:
luying
2022-09-16 17:44:59 +08:00
parent e9bd4f51f1
commit 3294f5ada0
7 changed files with 59 additions and 17 deletions
@@ -447,7 +447,7 @@ export class EquipHandler {
ePlace: newEplace, ePlace: newEplace,
consumes: updateConsumes, consumes: updateConsumes,
} }
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STONE, roleId, serverId, sid, hid, update, { ePlaceId, jewel, skinId: hero.skinId }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STONE, roleId, serverId, sid, hid, update, { ePlaceId, jewel, skinId: hero.skinId, stonesId });
await checkTaskInPutStone(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, jewel); await checkTaskInPutStone(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, jewel);
let curHero = { let curHero = {
@@ -485,7 +485,7 @@ export class HeroHandler {
} }
let isLv = oldLv != newLevel; let isLv = oldLv != newLevel;
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.CONNECT, roleId, serverId, sid, hero.hid, update); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.CONNECT, roleId, serverId, sid, hero.hid, update, { shipId });
if(isLv) { if(isLv) {
// await unlockFigure(sid, roleId, [{ type: FIGURE_UNLOCK_CONDITION.HERO_FAVOR, paramHid: curHero.hid, paramFavourLv: curHero.favourLv }]); // await unlockFigure(sid, roleId, [{ type: FIGURE_UNLOCK_CONDITION.HERO_FAVOR, paramHid: curHero.hid, paramFavourLv: curHero.favourLv }]);
await checkTaskInHeroGiveFavor(serverId, roleId, sid, shipId, newConnections, connections); await checkTaskInHeroGiveFavor(serverId, roleId, sid, shipId, newConnections, connections);
@@ -652,7 +652,7 @@ export class HeroHandler {
let { newSkins } = updateSkinTalent(skins, new Talent(id), usedTalentPoint + needTalentPoint); let { newSkins } = updateSkinTalent(skins, new Talent(id), usedTalentPoint + needTalentPoint);
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT, roleId, serverId, sid, hid, { skins: newSkins }); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT_UNLOCK, roleId, serverId, sid, hid, { skins: newSkins }, { talentId: id });
const heroResult = new HeroParam(curHero); const heroResult = new HeroParam(curHero);
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }}); return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }});
@@ -689,7 +689,7 @@ export class HeroHandler {
let { newSkins } = updateSkinTalent(skins, new Talent(id, talent.level + 1), usedTalentPoint + needTalentPoint); let { newSkins } = updateSkinTalent(skins, new Talent(id, talent.level + 1), usedTalentPoint + needTalentPoint);
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT, roleId, serverId, sid, hid, { skins: newSkins }); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT_LV, roleId, serverId, sid, hid, { skins: newSkins }, { talentId: id });
const heroResult = new HeroParam(curHero); const heroResult = new HeroParam(curHero);
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }}); return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }});
} }
@@ -714,7 +714,7 @@ export class HeroHandler {
let newSkins = initSkinTalent(skins); let newSkins = initSkinTalent(skins);
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT, roleId, serverId, sid, hid, { skins: newSkins }); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT_RESET, roleId, serverId, sid, hid, { skins: newSkins });
const heroResult = new HeroParam(curHero); const heroResult = new HeroParam(curHero);
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }}); return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }});
+39 -7
View File
@@ -41,7 +41,9 @@ interface Param {
roleIncUpdate?: RoleUpdate; roleIncUpdate?: RoleUpdate;
heroes?: HeroType[], heroes?: HeroType[],
schools?: SchoolType[]; schools?: SchoolType[];
skins?: SkinType[] skins?: SkinType[],
stonesId?: number,
talentId?: number,
} }
export async function calculateCeWithHero(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, hid: number, heroUpdate: HeroUpdate, param: Param = {}) { export async function calculateCeWithHero(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, hid: number, heroUpdate: HeroUpdate, param: Param = {}) {
@@ -58,6 +60,7 @@ export async function calculateCeWithRole(type: HERO_SYSTEM_TYPE, roleId: string
} }
export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, heroUpdates: Map<number, HeroUpdate>, roleUpdate: RoleUpdate, roleIncUpdate: RoleUpdate, param: Param = {}) { export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, heroUpdates: Map<number, HeroUpdate>, roleUpdate: RoleUpdate, roleIncUpdate: RoleUpdate, param: Param = {}) {
const ceChangeTxt: string[] = [];
let calCe = new CalCe(roleId); let calCe = new CalCe(roleId);
let roleCe = await RoleCeModel.findByRoleId(roleId); let roleCe = await RoleCeModel.findByRoleId(roleId);
calCe.setRoleCe(roleCe); calCe.setRoleCe(roleCe);
@@ -65,6 +68,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
case HERO_SYSTEM_TYPE.INIT: case HERO_SYSTEM_TYPE.INIT:
{ {
for(let [hid, { skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, skins }] of heroUpdates) { for(let [hid, { skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, skins }] of heroUpdates) {
ceChangeTxt.push(`获得武将 ${hid}`);
calCe.setHeroBase(hid, skinId); calCe.setHeroBase(hid, skinId);
calCe.setHeroLv(hid, lv); calCe.setHeroLv(hid, lv);
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage); calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
@@ -83,6 +87,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
case HERO_SYSTEM_TYPE.LVUP: // 1. 升级 case HERO_SYSTEM_TYPE.LVUP: // 1. 升级
{ {
for(let [hid, { lv }] of heroUpdates) { for(let [hid, { lv }] of heroUpdates) {
ceChangeTxt.push(`武将 ${hid} 升级到 ${lv}`);
calCe.setHeroLv(hid, lv); calCe.setHeroLv(hid, lv);
} }
break; break;
@@ -90,6 +95,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
case HERO_SYSTEM_TYPE.STAR: // 2. 升星 case HERO_SYSTEM_TYPE.STAR: // 2. 升星
{ {
for(let [hid, { star, starStage }] of heroUpdates) { for(let [hid, { star, starStage }] of heroUpdates) {
ceChangeTxt.push(`武将 ${hid} 升星到 ${star} 星 ${starStage} 阶`);
let { hero: { quality, job, colorStar, colorStarStage }, isUpStar } = param; let { hero: { quality, job, colorStar, colorStarStage }, isUpStar } = param;
await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, isUpStar); await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, isUpStar);
} }
@@ -98,6 +104,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
case HERO_SYSTEM_TYPE.QUALITY: // 3. 升品 case HERO_SYSTEM_TYPE.QUALITY: // 3. 升品
{ {
for(let [hid, { quality }] of heroUpdates) { for(let [hid, { quality }] of heroUpdates) {
ceChangeTxt.push(`武将 ${hid} 升品到 ${quality} 品`);
let { hero: { star, starStage, colorStar, colorStarStage, job } } = param; let { hero: { star, starStage, colorStar, colorStarStage, job } } = param;
await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, true); await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, true);
} }
@@ -106,6 +113,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
case HERO_SYSTEM_TYPE.COLORSTAR: // 4. 觉醒 case HERO_SYSTEM_TYPE.COLORSTAR: // 4. 觉醒
{ {
for(let [hid, { quality, colorStar, colorStarStage }] of heroUpdates) { for(let [hid, { quality, colorStar, colorStarStage }] of heroUpdates) {
ceChangeTxt.push(`武将 ${hid} 升彩星到 ${quality} 星`);
let { hero: { star, starStage, job }, isUpStar } = param; let { hero: { star, starStage, job }, isUpStar } = param;
await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, isUpStar); await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, isUpStar);
} }
@@ -115,6 +123,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
case HERO_SYSTEM_TYPE.STAGEUP: // 6. 职业进阶 case HERO_SYSTEM_TYPE.STAGEUP: // 6. 职业进阶
{ {
for(let [hid, { job, jobStage }] of heroUpdates) { for(let [hid, { job, jobStage }] of heroUpdates) {
ceChangeTxt.push(`武将 ${hid} 的职业升到 ${job} ${jobStage} 阶`);
calCe.setJob(hid, job, jobStage); calCe.setJob(hid, job, jobStage);
} }
break; break;
@@ -123,6 +132,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
{ {
let { hero: { quality, star, starStage, colorStar, colorStarStage, jobStage } } = param; let { hero: { quality, star, starStage, colorStar, colorStarStage, jobStage } } = param;
for(let [hid, { skinId, job, ePlace, skins }] of heroUpdates) { for(let [hid, { skinId, job, ePlace, skins }] of heroUpdates) {
ceChangeTxt.push(`武将 ${hid} 穿上了皮肤 ${skinId}`);
calCe.setHeroBase(hid, skinId); calCe.setHeroBase(hid, skinId);
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage); calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
calCe.setJob(hid, job, jobStage); calCe.setJob(hid, job, jobStage);
@@ -138,7 +148,10 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
} }
case HERO_SYSTEM_TYPE.CONNECT: // 9. 羁绊 case HERO_SYSTEM_TYPE.CONNECT: // 9. 羁绊
{ {
let { shipId } = param;
for(let [ hid, { connections } ] of heroUpdates) { for(let [ hid, { connections } ] of heroUpdates) {
let curConnect = connections?.find(cur => cur.shipId);
ceChangeTxt.push(`武将 ${hid} 的羁绊 ${shipId} 升级到 ${curConnect?.level} 级`);
calCe.setConnection(hid, connections); calCe.setConnection(hid, connections);
} }
break; break;
@@ -147,6 +160,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
{ {
let { skinId } = param; let { skinId } = param;
calCe.setAddSkin(skinId); calCe.setAddSkin(skinId);
ceChangeTxt.push(`获得皮肤 ${skinId}`);
break; break;
} }
case HERO_SYSTEM_TYPE.SCHOOL: // 16. 放百家学宫 case HERO_SYSTEM_TYPE.SCHOOL: // 16. 放百家学宫
@@ -154,10 +168,12 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
let { schoolId, schoolHid, preSchoolHid, hero } = param; let { schoolId, schoolHid, preSchoolHid, hero } = param;
if(preSchoolHid) { if(preSchoolHid) {
calCe.setSchool(false, preSchoolHid, schoolId, 0, 0, 0); calCe.setSchool(false, preSchoolHid, schoolId, 0, 0, 0);
ceChangeTxt.push(`将武将 ${preSchoolHid} 从百家学宫移除`);
} }
if(schoolHid) { if(schoolHid) {
let { star, colorStar, quality } = hero; let { star, colorStar, quality } = hero;
calCe.setSchool(true, schoolHid, schoolId, star, colorStar, quality); calCe.setSchool(true, schoolHid, schoolId, star, colorStar, quality);
ceChangeTxt.push(`将武将 ${schoolHid} 放置到百家学宫`);
} }
break; break;
} }
@@ -165,6 +181,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
{ {
for(let [hid, { scrollStar, scrollQuality, scrollColorStar }] of heroUpdates) { for(let [hid, { scrollStar, scrollQuality, scrollColorStar }] of heroUpdates) {
calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar); calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar);
ceChangeTxt.push(`将武将 ${hid} 的名将谱激活至 ${scrollStar}星 ${scrollQuality}品 ${scrollColorStar}彩星`);
} }
break; break;
} }
@@ -172,13 +189,16 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
{ {
let { title } = roleUpdate; let { title } = roleUpdate;
calCe.setTitle(title); calCe.setTitle(title);
ceChangeTxt.push(`爵位升级至 ${title}`);
break; break;
} }
case HERO_SYSTEM_TYPE.TERAPH: // 19. 神像 case HERO_SYSTEM_TYPE.TERAPH: // 19. 神像
case HERO_SYSTEM_TYPE.TERAPH_UP: // 20. 神像进阶 case HERO_SYSTEM_TYPE.TERAPH_UP: // 20. 神像进阶
{ {
let { teraphId } = param;
let { teraphs } = roleUpdate; let { teraphs } = roleUpdate;
calCe.setTeraph(teraphs); calCe.setTeraph(teraphs);
ceChangeTxt.push(`神像 ${teraphId} 升级或进阶`);
break; break;
} }
case HERO_SYSTEM_TYPE.COMPOSE_EQUIP: // 21. 合成装备 case HERO_SYSTEM_TYPE.COMPOSE_EQUIP: // 21. 合成装备
@@ -190,6 +210,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage); calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
calCe.setEquipStrength(hid, id, equipId, lv); calCe.setEquipStrength(hid, id, equipId, lv);
calCe.setEquipStar(hid, id, equipId, star, starStage); calCe.setEquipStar(hid, id, equipId, star, starStage);
ceChangeTxt.push(`武将 ${hid} 的 ${equipId} 装备合成装备`);
} }
} }
calCe.setEquipSuit(hid, skinId, ePlace); calCe.setEquipSuit(hid, skinId, ePlace);
@@ -203,6 +224,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
for(let { id, equipId, lv } of ePlace) { for(let { id, equipId, lv } of ePlace) {
if(ePlaceIds.indexOf(id) != -1) { if(ePlaceIds.indexOf(id) != -1) {
calCe.setEquipStrength(hid, id, equipId, lv); calCe.setEquipStrength(hid, id, equipId, lv);
ceChangeTxt.push(`武将 ${hid} 的 ${equipId} 装备升级到 ${lv} 级`);
} }
} }
} }
@@ -215,6 +237,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
for(let { id, equipId, quality, qualityStage } of ePlace) { for(let { id, equipId, quality, qualityStage } of ePlace) {
if(ePlaceId == id) { if(ePlaceId == id) {
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage); calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
ceChangeTxt.push(`武将 ${hid} 的 ${equipId} 装备升级到 ${quality} 品 ${qualityStage} 阶`);
} }
} }
} }
@@ -227,6 +250,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
for(let { id, equipId, star, starStage } of ePlace) { for(let { id, equipId, star, starStage } of ePlace) {
if(ePlaceId == id) { if(ePlaceId == id) {
calCe.setEquipStar(hid, id, equipId, star, starStage); calCe.setEquipStar(hid, id, equipId, star, starStage);
ceChangeTxt.push(`武将 ${hid} 的 ${equipId} 装备精炼到 ${star} 星 ${starStage} 阶`);
} }
} }
calCe.setEquipSuit(hid, skinId, ePlace); calCe.setEquipSuit(hid, skinId, ePlace);
@@ -242,6 +266,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
for(let { id, stones } of ePlace) { for(let { id, stones } of ePlace) {
if(ePlaceId == id) { if(ePlaceId == id) {
calCe.setJewel(hid, id, stones, curJewel); calCe.setJewel(hid, id, stones, curJewel);
ceChangeTxt.push(`武将 ${hid} 的 ${ePlaceId} 装备栏的天晶 ${curJewel.id} 装备或洗练或淬炼`);
} }
} }
calCe.setEquipSuit(hid, skinId, ePlace); calCe.setEquipSuit(hid, skinId, ePlace);
@@ -250,12 +275,14 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
} }
case HERO_SYSTEM_TYPE.EQUIP_STONE: // 26. 装备地玉 case HERO_SYSTEM_TYPE.EQUIP_STONE: // 26. 装备地玉
{ {
let { ePlaceId, jewel: curJewel, skinId } = param; let { ePlaceId, jewel: curJewel, skinId, stonesId } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) { for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, stones } of ePlace) { for(let { id, stones } of ePlace) {
if(ePlaceId == id) { if(ePlaceId == id) {
calCe.setStone(hid, ePlaceId, stones); calCe.setStone(hid, ePlaceId, stones);
calCe.setJewel(hid, id, stones, curJewel); calCe.setJewel(hid, id, stones, curJewel);
ceChangeTxt.push(`武将 ${hid} 的 ${ePlaceId} 装备栏装备地玉 ${stonesId}`);
} }
} }
calCe.setEquipSuit(hid, skinId, ePlace); calCe.setEquipSuit(hid, skinId, ePlace);
@@ -274,17 +301,23 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
calCe.setTalent(hid, skins); calCe.setTalent(hid, skins);
calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar); calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar);
if(schoolId) calCe.setSchool(true, hid, schoolId, star, colorStar, quality); if(schoolId) calCe.setSchool(true, hid, schoolId, star, colorStar, quality);
ceChangeTxt.push(`武将 ${hid} 重生`);
} }
break; break;
} }
case HERO_SYSTEM_TYPE.TALENT: // 30. 天赋 case HERO_SYSTEM_TYPE.TALENT_UNLOCK: // 30. 天赋解锁
case HERO_SYSTEM_TYPE.TALENT_LV: // 32. 天赋升级
case HERO_SYSTEM_TYPE.TALENT_RESET: // 30. 天赋洗点
{ {
let { talentId } = param;
for(let [hid, { skins }] of heroUpdates) { for(let [hid, { skins }] of heroUpdates) {
calCe.setTalent(hid, skins); calCe.setTalent(hid, skins);
ceChangeTxt.push(`武将 ${hid} 天赋 ${talentId} 解锁、升级、洗点`);
} }
break; break;
} }
case HERO_SYSTEM_TYPE.RE_CAL: // 31. 玩家等级 case HERO_SYSTEM_TYPE.RE_CAL: // 31. 重新计算
{ {
let { role, schools, jewels, heroes, skins } = param; let { role, schools, jewels, heroes, skins } = param;
calCe.clearRoleCe(); calCe.clearRoleCe();
@@ -317,6 +350,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
for(let { id } of skins) { for(let { id } of skins) {
calCe.setAddSkin(id); calCe.setAddSkin(id);
} }
ceChangeTxt.push(`后台重新计算`);
break; break;
} }
} }
@@ -335,7 +369,6 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力 await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力
await LadderMatchModel.updateCe(roleId, hid, ce); await LadderMatchModel.updateCe(roleId, hid, ce);
pushHeros.push({ hid, ce, incHeroCe: inc }); pushHeros.push({ hid, ce, incHeroCe: inc });
changeHids.push(hid);
} else { } else {
let hero = await HeroModel.updateHeroInfo(roleId, hid, heroUpdate); let hero = await HeroModel.updateHeroInfo(roleId, hid, heroUpdate);
heroes.push(hero); heroes.push(hero);
@@ -347,7 +380,6 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力 await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力
await LadderMatchModel.updateCe(roleId, hid, ce); await LadderMatchModel.updateCe(roleId, hid, ce);
pushHeros.push({ hid, ce: hero.ce, incHeroCe: inc }); pushHeros.push({ hid, ce: hero.ce, incHeroCe: inc });
changeHids.push(hid);
} }
} }
@@ -361,7 +393,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
let role = await RoleModel.incRoleInfo(roleId, { ...roleIncUpdate, ce: roleInc }, { ...roleUpdate, topLineup, topLineupCe }); let role = await RoleModel.incRoleInfo(roleId, { ...roleIncUpdate, ce: roleInc }, { ...roleUpdate, topLineup, topLineupCe });
let guild = await GuildModel.updateCe(roleId, roleInc); // 公会更新战力 let guild = await GuildModel.updateCe(roleId, roleInc); // 公会更新战力
saveCeChangeLog(role, roleInc, role.ce, type, changeHids); saveCeChangeLog(role, roleInc, role.ce, type, ceChangeTxt);
updateRank(roleId, serverId, topLineupCe, role, pushHeros, guild); updateRank(roleId, serverId, topLineupCe, role, pushHeros, guild);
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.PLAYER_CE_UPDATE, { ce: role.ce, heros: pushHeros, topLineupCe }, sid); sendMessageToUserWithSuc(roleId, PUSH_ROUTE.PLAYER_CE_UPDATE, { ce: role.ce, heros: pushHeros, topLineupCe }, sid);
if(hasTopCeChange) await updateRoleOnlineInfo(roleId, { topLineupCe }); if(hasTopCeChange) await updateRoleOnlineInfo(roleId, { topLineupCe });
+3 -1
View File
@@ -30,8 +30,10 @@ export enum HERO_SYSTEM_TYPE {
JEWEL_RESET_RANDSE = 27, // 天晶石洗练 JEWEL_RESET_RANDSE = 27, // 天晶石洗练
JEWEL_QUENCH = 28, // 天晶石淬炼 JEWEL_QUENCH = 28, // 天晶石淬炼
REBIRTH = 29, // 武将重生 REBIRTH = 29, // 武将重生
TALENT = 30, // 天赋 TALENT_UNLOCK = 30, // 天赋解锁
RE_CAL = 31, // 重新计算 RE_CAL = 31, // 重新计算
TALENT_LV = 32, // 天赋升级
TALENT_RESET = 33, // 天赋重置
}; };
// 武将上限 // 武将上限
+6 -2
View File
@@ -84,8 +84,8 @@ export default class UserLog extends BaseModel {
@prop({ required: false }) @prop({ required: false })
ceChangeReason: number; // 战力变化原因 ceChangeReason: number; // 战力变化原因
@prop({ required: false, type: Number }) @prop({ required: false, type: String })
ceChangeIds: number[]; // 战力变化原因信息,如武将id等 ceChangeTxt: string[]; // 战力变化原因信息,如武将id等
// 充值相关 // 充值相关
@prop({ required: false }) @prop({ required: false })
@@ -180,6 +180,10 @@ export default class UserLog extends BaseModel {
if (form.uid) searchObj['uid'] = form.uid; if (form.uid) searchObj['uid'] = form.uid;
if (form.roleId) searchObj['roleId'] = form.roleId; if (form.roleId) searchObj['roleId'] = form.roleId;
if(form.roleName) searchObj['roleName'] = { $regex: new RegExp(form.roleName.toString(), 'i') }; if(form.roleName) searchObj['roleName'] = { $regex: new RegExp(form.roleName.toString(), 'i') };
if (form.guildCode) searchObj['guildCode'] = form.guildCode;
if (form.itemId) searchObj['itemId'] = form.itemId;
if (form.itemChangeReason != undefined) searchObj['itemChangeReason'] = form.itemChangeReason;
if (form.ceChangeReason != undefined) searchObj['ceChangeReason'] = form.ceChangeReason;
if (form.createTimeStart && form.createTimeEnd) { if (form.createTimeStart && form.createTimeEnd) {
searchObj['createdAt'] = { $lte: new Date(form.createTimeEnd * 1000), $gte: new Date(form.createTimeStart * 1000) }; searchObj['createdAt'] = { $lte: new Date(form.createTimeEnd * 1000), $gte: new Date(form.createTimeStart * 1000) };
} }
+4
View File
@@ -96,6 +96,10 @@ export interface SearchUserLogParam {
uid?: number; uid?: number;
roleId?: string; roleId?: string;
roleName?: string; roleName?: string;
guildCode?: string;
itemId?: number;
itemChangeReason?: number;
ceChangeReason?: number;
createTimeStart?: number; createTimeStart?: number;
createTimeEnd?: number; createTimeEnd?: number;
} }
+2 -2
View File
@@ -35,11 +35,11 @@ export async function saveLoginAndOutLog(type: LOG_TYPE, session: any) {
} }
} }
export async function saveCeChangeLog(role: RoleType, inc: number, count: number, type: number, ids: number[]) { export async function saveCeChangeLog(role: RoleType, inc: number, count: number, type: number, ids: string[]) {
try { try {
if(inc != 0) { if(inc != 0) {
let params = getParamByRole(role); let params = getParamByRole(role);
await UserLogModel.createRecord({ type: LOG_TYPE.CE_CHANGE, ...params, inc, count, ceChangeReason: type, ceChangeIds: ids }); await UserLogModel.createRecord({ type: LOG_TYPE.CE_CHANGE, ...params, inc, count, ceChangeReason: type, ceChangeTxt: ids });
} }
} catch (e) { } catch (e) {
console.error(e); console.error(e);