This commit is contained in:
aozhiwei 2024-05-26 11:06:15 +08:00
parent df0226e113
commit 16f96a7d65
2 changed files with 21 additions and 2 deletions

View File

@ -5,3 +5,5 @@ const (
CONTROLLER_MGR_MODULE_IDX CONTROLLER_MGR_MODULE_IDX
MAX_MODULE_IDX MAX_MODULE_IDX
) )
const GAME_ID = 2006

View File

@ -3,6 +3,8 @@ package controller
import ( import (
"q5" "q5"
"f5" "f5"
"main/constant"
"encoding/json"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -11,6 +13,21 @@ type GameLog struct {
} }
func (this *GameLog) caCustomReport(c *gin.Context) { func (this *GameLog) caCustomReport(c *gin.Context) {
rspObj := struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"`
}{}
postContent, err := c.GetRawData()
if err != nil || postContent == nil {
c.JSON(200, rspObj)
return
}
var data map[string]interface{}
if err := json.Unmarshal(postContent, &data); err != nil {
c.JSON(200, rspObj)
return
}
accountId := c.DefaultQuery("account_id", "") accountId := c.DefaultQuery("account_id", "")
sessionId := c.DefaultQuery("session_id", "") sessionId := c.DefaultQuery("session_id", "")
distinctId := c.DefaultQuery("localuuid", "") distinctId := c.DefaultQuery("localuuid", "")
@ -23,7 +40,6 @@ func (this *GameLog) caCustomReport(c *gin.Context) {
_serverTime := f5.GetApp().GetRealSeconds() _serverTime := f5.GetApp().GetRealSeconds()
ip := c.Request.Header.Get("X-real-ip") ip := c.Request.Header.Get("X-real-ip")
data := map[string]interface{}{}
if accountId != "" { if accountId != "" {
data["account_id"] = accountId data["account_id"] = accountId
registerTime := f5.ExtractRegisterTimeFromSessionId(sessionId) registerTime := f5.ExtractRegisterTimeFromSessionId(sessionId)
@ -42,9 +58,10 @@ func (this *GameLog) caCustomReport(c *gin.Context) {
data["_server_time"] = _serverTime data["_server_time"] = _serverTime
f5.GetTgLog().AddCustomLog( f5.GetTgLog().AddCustomLog(
2006, constant.GAME_ID,
accountId, accountId,
distinctId, distinctId,
ip, ip,
data) data)
c.JSON(200, rspObj)
} }