日志:记录重生数据

This commit is contained in:
luying
2022-09-08 14:14:57 +08:00
parent 115ad2354e
commit 21df1c5cbf
4 changed files with 20 additions and 0 deletions

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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);
}
}