From e573463879bd6e82e3071bd7c9fd4586781e11f3 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 19 Jun 2023 17:28:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=BB=9C=E9=80=9A?= =?UTF-8?q?=E4=BF=A1=E5=A4=B1=E8=B4=A5=E7=9A=84=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 21 +++++++++++++++++++++ lua/app/net/net_manager.lua | 25 ++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index fa81f170..a30475cf 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -186,6 +186,8 @@ BIReport.HERO_OPT_TYPE = { BIReport.NETWORK_OPT_TYPE = { DISCONNECT = "disconnect", RECONNECT = "reconnect", + ERROR_CODE = "errorCode", + PD_DECODE_FAILED = "pdDecodeFailed", } BIReport.DIALY_CHALLENGE_OPT_TYPE = { @@ -985,4 +987,23 @@ function BIReport:postDailyChallengeTaskState(completedCount, taskInfo) self:report(EVENT_NAME_DAILY_CHALLENGE_OPT, args) end +function BIReport:postNetError(pbName, code, reqData) + local args = { + event_type = BIReport.NETWORK_OPT_TYPE.ERROR_CODE, + pb_name = pbName, + error_code = code, + req_data = reqData + } + self:report(EVENT_NAME_NETWORK_OPT, args) +end + +function BIReport:postPbDecodefailed(pbName, reqData) + local args = { + event_type = BIReport.NETWORK_OPT_TYPE.PD_DECODE_FAILED, + pb_name = pbName, + req_data = reqData + } + self:report(EVENT_NAME_NETWORK_OPT, args) +end + return BIReport \ No newline at end of file diff --git a/lua/app/net/net_manager.lua b/lua/app/net/net_manager.lua index b8513ed9..0a768b67 100644 --- a/lua/app/net/net_manager.lua +++ b/lua/app/net/net_manager.lua @@ -699,6 +699,28 @@ function NetManager:onReceive(msgId, data) end end + if not ok or not pbData then + local reqDataStr = GConst.EMPTY_STRING + if sendInfo then + if sendInfo.msgName == ProtoMsgType.FromMsgEnum.PipedReq then + reqDataStr = json.encode(sendInfo.params.data) + else + reqDataStr = json.encode(sendInfo.params) + end + end + BIReport:postPbDecodefailed(sendMsgName, reqDataStr) + elseif pbData.err_code ~= GConst.ERROR_STR.SUCCESS then + local reqDataStr = GConst.EMPTY_STRING + if sendInfo then + if sendInfo.msgName == ProtoMsgType.FromMsgEnum.PipedReq then + reqDataStr = json.encode(sendInfo.params.data) + else + reqDataStr = json.encode(sendInfo.params) + end + end + BIReport:postNetError(sendMsgName, pbData.err_code, reqDataStr) + end + local callbacks = self.receiveCallbacks[msg] if callbacks and #callbacks > 0 then local receiveCallback = table.remove(callbacks, 1) @@ -709,9 +731,6 @@ function NetManager:onReceive(msgId, data) lockGame = receiveCallback.lockGame receiveFunc = receiveCallback.callback responseData = receiveCallback.responseData - if NOT_PUBLISH then - Logger.printTable(responseData) - end if pbData.err_code == GConst.ERROR_STR.SUCCESS and pbData.rewards then local getType = receiveCallback.getType if sendMsgName == "ActPayReq" then