From c782969986248c777b9f33e125de6686c049f5bc Mon Sep 17 00:00:00 2001 From: luying Date: Fri, 24 Dec 2021 19:45:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=EF=BC=9A=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/servers/role/handler/mailHandler.ts | 3 ++- shared/pubUtils/logUtil.ts | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/game-server/app/servers/role/handler/mailHandler.ts b/game-server/app/servers/role/handler/mailHandler.ts index e7517b756..a8397e193 100644 --- a/game-server/app/servers/role/handler/mailHandler.ts +++ b/game-server/app/servers/role/handler/mailHandler.ts @@ -13,6 +13,7 @@ import { RoleModel } from '../../../db/Role'; import { gameData } from '../../../pubUtils/data'; import { ITEM_CHANGE_REASON, ITID, RECEIVE_MAIL_TYPE } from '../../../consts'; import { BAG } from '../../../pubUtils/dicParam'; +import { saveMailLog } from '../../../pubUtils/logUtil'; export default function(app: Application) { return new MailHandler(app); @@ -147,7 +148,7 @@ export class MailHandler { } let resGoods = await addItems(roleId, roleName, sid, mailGoods, ITEM_CHANGE_REASON.MAIL); - + saveMailLog(session, mails); return resResult(STATUS.SUCCESS, { mails, goods: resGoods }); } } \ No newline at end of file diff --git a/shared/pubUtils/logUtil.ts b/shared/pubUtils/logUtil.ts index d6a58044f..61ee35bab 100644 --- a/shared/pubUtils/logUtil.ts +++ b/shared/pubUtils/logUtil.ts @@ -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[]) { try { - let params = getParamByRole(role); - await UserLogModel.createRecord({ type: LOG_TYPE.CE_CHANGE, ...params, inc, count, ceChangeReason: type, ceChangeIds: ids }); + if(inc != 0) { + let params = getParamByRole(role); + await UserLogModel.createRecord({ type: LOG_TYPE.CE_CHANGE, ...params, inc, count, ceChangeReason: type, ceChangeIds: ids }); + } } catch (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 params = getParamByRole(role); for (let { id, count, inc } of goods) { + if(inc == 0) continue; 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 }) }