日志:记录重生数据
This commit is contained in:
@@ -24,6 +24,7 @@ import { calculateCeWithHero } from '../../../services/playerCeService';
|
|||||||
import { SchoolModel } from '../../../db/School';
|
import { SchoolModel } from '../../../db/School';
|
||||||
import { SkinModel } from '../../../db/Skin';
|
import { SkinModel } from '../../../db/Skin';
|
||||||
import { RoleCeModel } from '../../../db/RoleCe';
|
import { RoleCeModel } from '../../../db/RoleCe';
|
||||||
|
import { saveRebirthLog } from '../../../pubUtils/logUtil';
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
new HandlerService(app, {});
|
new HandlerService(app, {});
|
||||||
@@ -612,6 +613,7 @@ export class HeroHandler {
|
|||||||
let school = await SchoolModel.findByHid(roleId, hid);
|
let school = await SchoolModel.findByHid(roleId, hid);
|
||||||
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.REBIRTH, roleId, serverId, sid, hid, initInfo, { schoolId: school?.schoolId });
|
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);
|
let goods = await addItems(roleId, roleName, sid, consumes, ITEM_CHANGE_REASON.REBIRTH);
|
||||||
|
saveRebirthLog(session, hero);
|
||||||
|
|
||||||
const heroResult = new HeroParam(curHero);
|
const heroResult = new HeroParam(curHero);
|
||||||
return resResult(STATUS.SUCCESS, { curHero: heroResult, curJewels, goods });
|
return resResult(STATUS.SUCCESS, { curHero: heroResult, curJewels, goods });
|
||||||
|
|||||||
@@ -1114,6 +1114,7 @@ export enum LOG_TYPE {
|
|||||||
RECEIVE_MAIL = 'receiveMail', // 领取邮件
|
RECEIVE_MAIL = 'receiveMail', // 领取邮件
|
||||||
GATE_HP = 'gateHp', // 诸侯混战城门
|
GATE_HP = 'gateHp', // 诸侯混战城门
|
||||||
BOSS_HP = 'bossHp', // 演武台boss血量
|
BOSS_HP = 'bossHp', // 演武台boss血量
|
||||||
|
REBIRTH = 'rebirth', // 演武台boss血量
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CE_CHANGE_REASON {
|
export enum CE_CHANGE_REASON {
|
||||||
|
|||||||
@@ -161,6 +161,13 @@ export default class UserLog extends BaseModel {
|
|||||||
@prop({ required: false, type: BossHpLog, _id: false })
|
@prop({ required: false, type: BossHpLog, _id: false })
|
||||||
bossHp: BossHpLog; // 诸侯混战血量参数
|
bossHp: BossHpLog; // 诸侯混战血量参数
|
||||||
|
|
||||||
|
// 重生记录
|
||||||
|
@prop({ required: false })
|
||||||
|
hid: number; // 武将id
|
||||||
|
|
||||||
|
@prop({ required: false })
|
||||||
|
heroInfo: string; // 武将信息
|
||||||
|
|
||||||
public static async createRecord(params: UserLogModelTypeParam) {
|
public static async createRecord(params: UserLogModelTypeParam) {
|
||||||
const r = await UserLogModel.insertMany(params);
|
const r = await UserLogModel.insertMany(params);
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ACTIVITY_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, HERO_SYSTEM_TYPE, LOG_TYPE } from "../consts";
|
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 { RoleModel, RoleType, RoleUpdate } from "../db/Role";
|
||||||
import { UserLogModel, GateHpLog, BossHpLog } from "../db/UserLog";
|
import { UserLogModel, GateHpLog, BossHpLog } from "../db/UserLog";
|
||||||
import { UserOrderModelType } from "../db/UserOrder";
|
import { UserOrderModelType } from "../db/UserOrder";
|
||||||
@@ -125,4 +126,13 @@ export async function saveGuildBossHpLog(serverId: number, warId: number, guildC
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(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