local HttpReq = require('Http/HttpReq') local HttpNetMsgManager = {} local private = { url = "", } local HeaderKey = "TYX-Request-Id" local HeaderValue = "f88a78a83463f1e03bbf0acb3883aefb" function HttpNetMsgManager.Init() private.baseFieldID = HttpReq.AskForBaseFields() end function HttpNetMsgManager.InitBaseField() private.SetStaticBaseField() end function HttpNetMsgManager.SetURL(url) if string.sub(url, string.len(url)) == "/" then private.url = url .. "log/v2/clientanalysis" else private.url = url .. "/log/v2/clientanalysis" end end ---发送服务器延时和超时协议的BI ---@param msgId 延时或者超时的协议id ---@param count 次数,因为是没隔一段时间统计的 ---@param type 类型1、延时,2、超时 function HttpNetMsgManager.SendNetMsgDelayToServer(msgId, count, type) local handle = HttpReq.Create(private.url, HttpReq.HTTPMethods.Post, nil, private.baseFieldID) HttpReq.AddHeader(handle, HeaderKey, HeaderValue) HttpReq.SetField(handle, "msgid", tostring(msgId)) HttpReq.SetField(handle, "count", tostring(count)) HttpReq.SetField(handle, "type", tostring(type)) HttpReq.Send(handle, private.baseFieldID, false) end function private.SetStaticBaseField() if MDL and MDL.Login then HttpReq.SetBaseField(private.baseFieldID, "serverid", MDL.Login.GetRealServerId() or "0") else HttpReq.SetBaseField(private.baseFieldID, "serverid", "0") end if BattleDataGetter then HttpReq.SetBaseField(private.baseFieldID, "accid", BattleDataGetter.GetAcID() or "0") else HttpReq.SetBaseField(private.baseFieldID, "accid", "0") end HttpReq.SetBaseField(private.baseFieldID, "gid", GameAppInfo.Global_ProductId) HttpReq.SetBaseField(private.baseFieldID, "buildinfo", string.format("%s_%s_%s", AppInfo.buildCounter, DEF.Package_BuildTime or 0, LoginProxy.Get_HotfixVer())) end return HttpNetMsgManager