数据过滤

This commit is contained in:
meixiongfeng 2023-12-01 18:36:55 +08:00
parent dcc921ff91
commit dc6af2c94b
3 changed files with 10 additions and 1 deletions

View File

@ -46,7 +46,9 @@ func (this *modelUserLog) AddUserLog(uid string, itype int32, tag string, data i
jsonStr []byte
logType string
)
if data == nil { // 过滤空数据
return
}
if jsonStr, err = json.Marshal(data); err != nil {
log.Errorln(err)
return
@ -55,7 +57,10 @@ func (this *modelUserLog) AddUserLog(uid string, itype int32, tag string, data i
logType = "add" // 新增资源类型
} else if itype == 1 {
logType = "sub" // 消耗资源类型
} else {
logType = "undefine"
}
if db.IsCross() { //如果是跨服 直接找到对应的本服
if tag, _, b := utils.UIdSplit(uid); b {
if conn, err := db.ServerDBConn(tag); err == nil {

View File

@ -622,6 +622,9 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
}
if len(reward) > 0 {
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "StonehengeEventReq", reward)
if len(eventConf.CostItem) > 0 {
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "StonehengeEventReq", eventConf.CostItem)
}
}
})

View File

@ -84,6 +84,7 @@ func (this *apiComp) Draw(session comm.IUserSession, req *pb.TurntableDrawReq) (
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "TurntableDrawReq", atno)
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "TurntableDrawReq", need)
})
return
}