You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
968 B
48 lines
968 B
package handler |
|
|
|
import ( |
|
"server/common" |
|
"server/db" |
|
"server/modules/web/app" |
|
|
|
"github.com/gin-gonic/gin" |
|
"github.com/liangdas/mqant/log" |
|
) |
|
|
|
// UploadFBReq 上报fb数据 |
|
type UploadFBReq struct { |
|
ChannelID int `json:"ChannelID" binding:"required"` |
|
FBC string `json:"FBC" binding:"required"` |
|
FBP string `json:"FBP" binding:"required"` |
|
} |
|
|
|
func UploadFB(c *gin.Context) { |
|
a := app.NewApp(c) |
|
defer func() { |
|
a.Response() |
|
}() |
|
// req := new(UploadFBReq) |
|
// if !a.S(req) { |
|
// return |
|
// } |
|
ip := a.GetRemoteIP() |
|
ua := c.Request.Header.Get("User-Agent") |
|
fbc := c.Request.Header.Get("fbc") |
|
fbp := c.Request.Header.Get("fbp") |
|
log.Debug("upload FB fbc:%v,fbp:%v,ip:%v,user-agent:%v", fbc, fbp, ip, ua) |
|
if ip == "" { |
|
return |
|
} |
|
|
|
if fbc == "" && fbp == "" { |
|
return |
|
} |
|
|
|
pa := &common.PlayerADData{IP: ip, ChannelID: a.Channel, FBC: fbc, FBP: fbp} |
|
db.Mysql().Get(pa) |
|
if pa.ID > 0 { |
|
return |
|
} |
|
pa.UserAgent = ua |
|
db.Mysql().Create(pa) |
|
}
|
|
|