后台:内存快照

This commit is contained in:
luying
2022-09-20 15:32:09 +08:00
parent a830ae040e
commit 2b687083de
12 changed files with 218 additions and 3 deletions

View File

@@ -1118,6 +1118,14 @@ export enum LOG_TYPE {
GATE_HP = 'gateHp', // 诸侯混战城门
BOSS_HP = 'bossHp', // 演武台boss血量
REBIRTH = 'rebirth', // 演武台boss血量
MEMORY = 'memory', // 保存内存
}
export enum MEMORY_LOG_TYPE {
ACTIVITY = 'activity', // 活动
PVP_SEASON = 'pvpSeason', // pvp赛季
GA_INDEX = 'gaIndex', // 军团活动index
COMBATTLE = 'comBattle', // 寻宝活动
}
export enum CE_CHANGE_REASON {

View File

@@ -62,7 +62,7 @@ export default class UserLog extends BaseModel {
@prop({ required: false })
uid: number; // uid
@prop({ required: true })
@prop({ required: false })
serverId: number; // 小区id
@prop({ required: false })
@@ -168,11 +168,26 @@ export default class UserLog extends BaseModel {
@prop({ required: false })
heroInfo: string; // 武将信息
// 内存
@prop({ required: false })
sid: string; // 线程
@prop({ required: false })
memoryLogField: string; // 类型
@prop({ required: false })
memoryData: string; // 内存数据
public static async createRecord(params: UserLogModelTypeParam) {
const r = await UserLogModel.insertMany(params);
return r;
}
public static async createRecords(params: UserLogModelTypeParam[]) {
const r = await UserLogModel.insertMany(params);
return r;
}
private static getSearchObj(form: SearchUserLogParam) {
let searchObj = {};
if (form.type) searchObj['type'] = form.type;

View File

@@ -135,4 +135,23 @@ export async function saveRebirthLog(session: any, hero: HeroType) {
} catch (e) {
console.error(e);
}
}
export async function saveMemoryLog(sid: string, memoryLogField: string, memoryData: string) {
try {
await UserLogModel.createRecord({ type: LOG_TYPE.MEMORY, sid, memoryLogField, memoryData });
} catch (e) {
console.error(e);
}
}
export async function saveMemoryLogs(sid: string, arr: { memoryLogField: string, memoryData: string} []) {
try {
let params = arr.map(({ memoryLogField, memoryData }) => {
return { type: LOG_TYPE.MEMORY, sid, memoryLogField, memoryData }
})
await UserLogModel.createRecords(params);
} catch (e) {
console.error(e);
}
}

View File

@@ -880,5 +880,12 @@
"name": "补单",
"module": "order",
"type": "update"
},
{
"id": 127,
"api": "gm.gmHandler.saveMemoryLog",
"name": "保存内存",
"module": "sys",
"type": "update"
}
]