From c2c3ee44b4f30f69bceb1f4778304a8d9e7d893e Mon Sep 17 00:00:00 2001 From: linquan <349589071@qq.com> Date: Wed, 20 Aug 2025 17:12:30 +0800 Subject: [PATCH] =?UTF-8?q?cdkey,=20=E7=99=BD=E5=90=8D=E5=8D=95=EF=BC=8C?= =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- caid.go | 1 + internal/controller/game_pub.go | 12 ++++++++++++ internal/serviceGame/internal/advertisement.go | 4 ++-- internal/serviceGame/internal/basicinfo.go | 7 ++----- internal/serviceGame/internal/cdKey.go | 5 ++++- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/caid.go b/caid.go index 054ffc5..bfdce9b 100644 --- a/caid.go +++ b/caid.go @@ -103,6 +103,7 @@ func ImportSPKIPublicKeyPEM() *rsa.PublicKey { return nil } } + func encrypt(deviceInfo map[string]string) (string, error) { pubKey := ImportSPKIPublicKeyPEM() fmt.Printf("data: len: %d\n pubkey: %v\n", len(deviceInfo), pubKey) diff --git a/internal/controller/game_pub.go b/internal/controller/game_pub.go index 2c7786e..fff377f 100644 --- a/internal/controller/game_pub.go +++ b/internal/controller/game_pub.go @@ -187,3 +187,15 @@ func (c *pubController) RefreshAccessToken(ctx context.Context, req *game.Refres res, err = serviceGame.Advertisement().RefreshAccessToken(ctx, req) return } + +func (c *pubController) UpdateWhiteIp(ctx context.Context, req *game.UpdateWhiteListReq) (res *game.UpdateWhiteListRes, err error) { + res = new(game.UpdateWhiteListRes) + res, err = serviceGame.GameWhiteList().Update(ctx, req) + return +} + +func (c *pubController) DelWhiteIp(ctx context.Context, req *game.DelWhiteListReq) (res *game.DelWhiteListRes, err error) { + res = new(game.DelWhiteListRes) + res, err = serviceGame.GameWhiteList().Del(ctx, req) + return +} diff --git a/internal/serviceGame/internal/advertisement.go b/internal/serviceGame/internal/advertisement.go index 2ed1522..5ba8abe 100644 --- a/internal/serviceGame/internal/advertisement.go +++ b/internal/serviceGame/internal/advertisement.go @@ -502,7 +502,7 @@ func GetCostReport(ctx context.Context, req *game.GetCostReportReq) (res *game.G func SendCaidMsg(ctx context.Context, url string, data map[string]interface{}) (string, error) { g.Client().SetHeader("Content-Type", "application/json") g.Client().SetHeader("Cache-Control", "no-cache") - log.Printf("sendMsgHugeAmount - url: %s, data: %s", url, gjson.MustEncodeString(data)) + log.Printf("SendCaidMsg - url: %s, data: %s", url, gjson.MustEncodeString(data)) marshal, _ := json.Marshal(data) bytes, err := g.Client().Post(ctx, url, string(marshal)) if err != nil { @@ -513,6 +513,6 @@ func SendCaidMsg(ctx context.Context, url string, data map[string]interface{}) ( if err != nil { return "", err } - fmt.Println("Deposit - json: ", tmp) + fmt.Println("SendCaidMsg - json: ", tmp) return tmp, err } diff --git a/internal/serviceGame/internal/basicinfo.go b/internal/serviceGame/internal/basicinfo.go index 98e1114..2042870 100644 --- a/internal/serviceGame/internal/basicinfo.go +++ b/internal/serviceGame/internal/basicinfo.go @@ -328,7 +328,7 @@ func GetAccount(ctx context.Context, req *game.AccountReq) (res *game.AccountRes } } if req.Account != "" { - query["AccountName"] = req.Account + query["AccountName"] = bson.M{"$regex": req.Account} } if req.Ident != "" { query["Identity"] = req.Ident @@ -336,9 +336,6 @@ func GetAccount(ctx context.Context, req *game.AccountReq) (res *game.AccountRes if req.Name != "" { query["RealName"] = req.Name } - if req.Name != "" { - query["RealName"] = req.Name - } if req.GmState != "" { gm, _ := strconv.Atoi(req.GmState) query["AccountType"] = gm @@ -347,7 +344,7 @@ func GetAccount(ctx context.Context, req *game.AccountReq) (res *game.AccountRes if !ok { return nil, errors.New("不存在数据库!") } - + log.Println("query: ", gjson.MustEncodeString(query)) res = new(game.AccountRes) res.Total, err = mongo.Collection("Account").Find(ctx, query).Count() err = mongo.Collection("Account").Find(ctx, query).Skip((req.PageNum - 1) * req.PageSize).Limit(req.PageSize).All(&res.Accounts) diff --git a/internal/serviceGame/internal/cdKey.go b/internal/serviceGame/internal/cdKey.go index b23894a..8004d03 100644 --- a/internal/serviceGame/internal/cdKey.go +++ b/internal/serviceGame/internal/cdKey.go @@ -155,7 +155,10 @@ func GetGiftExchange(ctx context.Context, req *game.GetGiftExchangeReq) (res *ga if gfile.Exists(path) && gfile.Size(path) != 0 && fileSize[path] != nil && gfile.Size(path) == fileSize[path].Size { res.State = 1 } - fileSize[path] = &FileSize{Size: gfile.Size(path), Times: 0} + err = g.Try(ctx, func(ctx context.Context) { + fileSize[path] = &FileSize{Size: gfile.Size(path), Times: 0} + }) + log.Println("GetGiftExchange err: ", err) return }