增加网络通信失败的上报

This commit is contained in:
xiekaidong 2023-06-19 17:28:05 +08:00
parent e7a0f46fcb
commit e573463879
2 changed files with 43 additions and 3 deletions

View File

@ -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

View File

@ -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