diff --git a/game-server/app/servers/role/handler/heroHandler.ts b/game-server/app/servers/role/handler/heroHandler.ts index e1de061c1..bee218953 100644 --- a/game-server/app/servers/role/handler/heroHandler.ts +++ b/game-server/app/servers/role/handler/heroHandler.ts @@ -24,6 +24,7 @@ import { calculateCeWithHero } from '../../../services/playerCeService'; import { SchoolModel } from '../../../db/School'; import { SkinModel } from '../../../db/Skin'; import { RoleCeModel } from '../../../db/RoleCe'; +import { saveRebirthLog } from '../../../pubUtils/logUtil'; export default function (app: Application) { new HandlerService(app, {}); @@ -612,6 +613,7 @@ export class HeroHandler { let school = await SchoolModel.findByHid(roleId, hid); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.REBIRTH, roleId, serverId, sid, hid, initInfo, { schoolId: school?.schoolId }); let goods = await addItems(roleId, roleName, sid, consumes, ITEM_CHANGE_REASON.REBIRTH); + saveRebirthLog(session, hero); const heroResult = new HeroParam(curHero); return resResult(STATUS.SUCCESS, { curHero: heroResult, curJewels, goods }); diff --git a/shared/consts/constModules/sysConst.ts b/shared/consts/constModules/sysConst.ts index b971683ff..003dbfc43 100644 --- a/shared/consts/constModules/sysConst.ts +++ b/shared/consts/constModules/sysConst.ts @@ -1114,6 +1114,7 @@ export enum LOG_TYPE { RECEIVE_MAIL = 'receiveMail', // 领取邮件 GATE_HP = 'gateHp', // 诸侯混战城门 BOSS_HP = 'bossHp', // 演武台boss血量 + REBIRTH = 'rebirth', // 演武台boss血量 } export enum CE_CHANGE_REASON { diff --git a/shared/db/UserLog.ts b/shared/db/UserLog.ts index 76a986668..4bb7d71cb 100644 --- a/shared/db/UserLog.ts +++ b/shared/db/UserLog.ts @@ -161,6 +161,13 @@ export default class UserLog extends BaseModel { @prop({ required: false, type: BossHpLog, _id: false }) bossHp: BossHpLog; // 诸侯混战血量参数 + // 重生记录 + @prop({ required: false }) + hid: number; // 武将id + + @prop({ required: false }) + heroInfo: string; // 武将信息 + public static async createRecord(params: UserLogModelTypeParam) { const r = await UserLogModel.insertMany(params); return r; diff --git a/shared/pubUtils/logUtil.ts b/shared/pubUtils/logUtil.ts index ea9561535..4850af19d 100644 --- a/shared/pubUtils/logUtil.ts +++ b/shared/pubUtils/logUtil.ts @@ -1,4 +1,5 @@ import { ACTIVITY_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, HERO_SYSTEM_TYPE, LOG_TYPE } from "../consts"; +import { HeroType } from "../db/Hero"; import { RoleModel, RoleType, RoleUpdate } from "../db/Role"; import { UserLogModel, GateHpLog, BossHpLog } from "../db/UserLog"; import { UserOrderModelType } from "../db/UserOrder"; @@ -125,4 +126,13 @@ export async function saveGuildBossHpLog(serverId: number, warId: number, guildC } catch (e) { console.error(e); } +} + +export async function saveRebirthLog(session: any, hero: HeroType) { + try { + let params = getParamBySession(session); + await UserLogModel.createRecord({ type: LOG_TYPE.REBIRTH, ...params, hid: hero.hid, heroInfo: JSON.stringify(hero) }); + } catch (e) { + console.error(e); + } } \ No newline at end of file