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 }) }