日志:修复玩家日志记录
This commit is contained in:
@@ -13,6 +13,7 @@ import { RoleModel } from '../../../db/Role';
|
|||||||
import { gameData } from '../../../pubUtils/data';
|
import { gameData } from '../../../pubUtils/data';
|
||||||
import { ITEM_CHANGE_REASON, ITID, RECEIVE_MAIL_TYPE } from '../../../consts';
|
import { ITEM_CHANGE_REASON, ITID, RECEIVE_MAIL_TYPE } from '../../../consts';
|
||||||
import { BAG } from '../../../pubUtils/dicParam';
|
import { BAG } from '../../../pubUtils/dicParam';
|
||||||
|
import { saveMailLog } from '../../../pubUtils/logUtil';
|
||||||
|
|
||||||
export default function(app: Application) {
|
export default function(app: Application) {
|
||||||
return new MailHandler(app);
|
return new MailHandler(app);
|
||||||
@@ -147,7 +148,7 @@ export class MailHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let resGoods = await addItems(roleId, roleName, sid, mailGoods, ITEM_CHANGE_REASON.MAIL);
|
let resGoods = await addItems(roleId, roleName, sid, mailGoods, ITEM_CHANGE_REASON.MAIL);
|
||||||
|
saveMailLog(session, mails);
|
||||||
return resResult(STATUS.SUCCESS, { mails, goods: resGoods });
|
return resResult(STATUS.SUCCESS, { mails, goods: resGoods });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,8 +34,10 @@ export async function saveLoginAndOutLog(type: LOG_TYPE, session: any) {
|
|||||||
|
|
||||||
export async function saveCeChangeLog(role: RoleType, inc: number, count: number, type: number, ids: number[]) {
|
export async function saveCeChangeLog(role: RoleType, inc: number, count: number, type: number, ids: number[]) {
|
||||||
try {
|
try {
|
||||||
let params = getParamByRole(role);
|
if(inc != 0) {
|
||||||
await UserLogModel.createRecord({ type: LOG_TYPE.CE_CHANGE, ...params, inc, count, ceChangeReason: type, ceChangeIds: ids });
|
let params = getParamByRole(role);
|
||||||
|
await UserLogModel.createRecord({ type: LOG_TYPE.CE_CHANGE, ...params, inc, count, ceChangeReason: type, ceChangeIds: ids });
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
@@ -67,6 +69,7 @@ export async function saveItemChangeLog(roleId: string, goods: { id: number, cou
|
|||||||
let role = await RoleModel.findByRoleId(roleId, 'userInfo roleId roleName serverId');
|
let role = await RoleModel.findByRoleId(roleId, 'userInfo roleId roleName serverId');
|
||||||
let params = getParamByRole(role);
|
let params = getParamByRole(role);
|
||||||
for (let { id, count, inc } of goods) {
|
for (let { id, count, inc } of goods) {
|
||||||
|
if(inc == 0) continue;
|
||||||
let dicGoods = gameData.goods.get(id);
|
let dicGoods = gameData.goods.get(id);
|
||||||
await UserLogModel.createRecord({ type: LOG_TYPE.ITEM_CHANGE, ...params, itemId: id, itemName: dicGoods.name, itid: dicGoods.itid, inc, count, itemChangeReason: reason })
|
await UserLogModel.createRecord({ type: LOG_TYPE.ITEM_CHANGE, ...params, itemId: id, itemName: dicGoods.name, itid: dicGoods.itid, inc, count, itemChangeReason: reason })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user