日志:记录重生数据
This commit is contained in:
@@ -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 });
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user