From 6c4b085ceb94e48398598041e630e7d9659bddd8 Mon Sep 17 00:00:00 2001 From: mofangmin Date: Fri, 26 Jul 2024 17:44:03 +0800 Subject: [PATCH] =?UTF-8?q?fb=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- call/user.go | 28 +++++++++++++++++++--------- modules/web/handler/vip.go | 10 +++++----- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/call/user.go b/call/user.go index 5750011..684297f 100644 --- a/call/user.go +++ b/call/user.go @@ -7,6 +7,7 @@ import ( "fmt" "math/rand" "reflect" + "regexp" "server/common" "server/config" "server/db" @@ -196,17 +197,26 @@ func NewUser(info *common.PlayerDBInfo, ip, share, fbc, fbp, agent string) error // fb绑定 func FBBind(ip string, uid, cid int, fbc, fbp, agent string) { // 优先ip绑定 - pa := &common.PlayerADData{IP: ip, ChannelID: cid} - db.Mysql().GetLast(pa) - if pa.ID != 0 { - if pa.UID == 0 { - db.Mysql().Update(pa, map[string]interface{}{"uid": uid}) - } else { - newPa := &common.PlayerADData{UID: uid, IP: ip, ChannelID: cid, FBC: pa.FBC, FBP: pa.FBP, UserAgent: agent} - db.Mysql().Create(newPa) - } + // pa := &common.PlayerADData{IP: ip, ChannelID: cid} + var ret []common.PlayerADData + _, err := db.Mysql().QueryAll(fmt.Sprintf("ip = '%s' and channel_id = %d ", ip, cid), "id asc", &common.PlayerADData{}, &ret) + if err != nil { + log.Error("fbbind err:%v", err) return } + for _, pa := range ret { + // 判断fbc 是否满足要求 + re := regexp.MustCompile(`^fb\.1\.\d+\.[a-zA-Z0-9\-_]+$`) + if re.MatchString(pa.FBC) { + if pa.UID == 0 { + db.Mysql().Update(pa, map[string]interface{}{"uid": uid}) + } else { + newPa := &common.PlayerADData{UID: uid, IP: ip, ChannelID: cid, FBC: pa.FBC, FBP: pa.FBP, UserAgent: agent} + db.Mysql().Create(newPa) + } + return + } + } // 绑定fb数据 if len(fbc) != 0 || len(fbp) != 0 { diff --git a/modules/web/handler/vip.go b/modules/web/handler/vip.go index eedf6dc..adcd2c5 100644 --- a/modules/web/handler/vip.go +++ b/modules/web/handler/vip.go @@ -144,7 +144,7 @@ func DrawVipBonus(c *gin.Context) { bonus := con.Bonus if bonus <= 0 { a.Code = values.CodeParam - a.Msg = "reward invalid" + a.Msg = "इनाम अमान्य" return } newDraws := vip.Draws | flag @@ -193,7 +193,7 @@ func DrawVipCashback(c *gin.Context) { db.Mysql().UpdateResW(&common.VipData{}, map[string]interface{}{"profit_time": now.Unix(), "cashback": 0, "profit": 0}, fmt.Sprintf("uid = %v and profit_time = %v", a.UID, vip.ProfitTime)) a.Code = values.CodeParam - a.Msg = "reward invalid" + a.Msg = "इनाम अमान्य" return } else { cashback = vip.Profit * con.Cashback / 1000 @@ -208,7 +208,7 @@ func DrawVipCashback(c *gin.Context) { db.Mysql().UpdateResW(&common.VipData{}, map[string]interface{}{"profit_time": now.Unix(), "cashback": 0, "profit": 0}, fmt.Sprintf("uid = %v and profit_time = %v", a.UID, vip.ProfitTime)) a.Code = values.CodeParam - a.Msg = "reward invalid" + a.Msg = "इनाम अमान्य" return } else { cashback = vip.Profit * con.Cashback / 1000 @@ -220,7 +220,7 @@ func DrawVipCashback(c *gin.Context) { if cashback <= 0 { a.Code = values.CodeParam - a.Msg = "reward invalid" + a.Msg = "इनाम अमान्य" return } @@ -233,7 +233,7 @@ func DrawVipCashback(c *gin.Context) { if err != nil || rows == 0 { log.Error("err:%v", err) a.Code = values.CodeParam - a.Msg = "reward invalid" + a.Msg = "इनाम अमान्य" return } _, err = call.UpdateCurrencyPro(&common.UpdateCurrency{ -- 2.36.2