From 755c3dd43b2b3c95962b816c782fdeaea7d9f648 Mon Sep 17 00:00:00 2001 From: mofangmin Date: Tue, 25 Jun 2024 18:30:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- call/config.go | 9 +++++++++ modules/pay/gopay/base.go | 4 ++-- modules/pay/grepay/base.go | 4 ++-- modules/pay/mlpay/base.go | 4 ++-- modules/web/handler/game.go | 37 ++++++++++--------------------------- 5 files changed, 25 insertions(+), 33 deletions(-) diff --git a/call/config.go b/call/config.go index 095b206..15cce45 100644 --- a/call/config.go +++ b/call/config.go @@ -9,6 +9,7 @@ import ( "server/db" "server/util" "sort" + "strings" "time" "github.com/liangdas/mqant/log" @@ -721,6 +722,14 @@ func GetConfigGameListByID(provider, gameID int) *common.ConfigGameList { return nil } +func GetConfigGameListByName(name string) (ret []*common.ConfigGameList) { + for _, v := range configGameList { + if strings.Index(v.Name, name) != -1 { + ret = append(ret, v) + } + } + return +} func GetConfigGameListByType(t int) []*common.ConfigGameList { ret := []*common.ConfigGameList{} for _, v := range configGameList { diff --git a/modules/pay/gopay/base.go b/modules/pay/gopay/base.go index 8ee51c6..c4aeb80 100644 --- a/modules/pay/gopay/base.go +++ b/modules/pay/gopay/base.go @@ -73,7 +73,7 @@ func (s *Sub) GetResp() (proto.Message, error) { func (s *Sub) PackPayReq() interface{} { r := s.Base.PayReq send := &PayReq{ - Amount: r.Amount * 100, + Amount: r.Amount / 100, Currency: "INR", MerID: mid, NotifyURL: values.GetPayCallback(values.GoPay), @@ -94,7 +94,7 @@ func (s *Sub) PackWithdrawReq() interface{} { return nil } send := &WithdrawReq{ - Amount: r.Amount * 100, + Amount: r.Amount / 100, Currency: "INR", MerID: mid, NotifyURL: values.GetWithdrawCallback(values.GoPay), diff --git a/modules/pay/grepay/base.go b/modules/pay/grepay/base.go index b4884f5..21ddaa0 100644 --- a/modules/pay/grepay/base.go +++ b/modules/pay/grepay/base.go @@ -96,7 +96,7 @@ func (s *Sub) PackPayReq() interface{} { CustOrderNo: r.OrderID, TranType: tranType, ClearType: "01", - PayAmt: r.Amount * 100, + PayAmt: r.Amount / 100, BackUrl: values.GetPayCallback(values.GrePay), FrontUrl: values.GetFrontCallback(), GoodsName: "shopbuy", @@ -123,7 +123,7 @@ func (s *Sub) PackWithdrawReq() interface{} { CasType: "00", Country: "IN", Currency: "INR", - CasAmt: r.Amount * 100, + CasAmt: r.Amount / 100, DeductWay: "02", CallBackUrl: values.GetWithdrawCallback(values.GrePay), Account: config.GetConfig().Pay.GrePay.WithdrawAccount, diff --git a/modules/pay/mlpay/base.go b/modules/pay/mlpay/base.go index 38e21df..d4ef22b 100644 --- a/modules/pay/mlpay/base.go +++ b/modules/pay/mlpay/base.go @@ -94,7 +94,7 @@ func (s *Sub) PackPayReq() interface{} { ApplicationID: ApplicationId, PayWay: 2, PartnerOrderNo: r.OrderID, - Amount: r.Amount * 100, + Amount: r.Amount / 100, Currency: "INR", Name: r.Name, GameId: int(r.UID), @@ -115,7 +115,7 @@ func (s *Sub) PackWithdrawReq() interface{} { send := &WithdrawReq{ PartnerID: PartnerId, PartnerWithdrawNo: r.OrderID, - Amount: r.Amount * 100, + Amount: r.Amount / 100, Currency: "INR", GameId: fmt.Sprintf("%d", r.UID), NotifyURL: values.GetWithdrawCallback(values.MLPay), diff --git a/modules/web/handler/game.go b/modules/web/handler/game.go index a822809..033b855 100644 --- a/modules/web/handler/game.go +++ b/modules/web/handler/game.go @@ -231,31 +231,14 @@ func GameSearch(c *gin.Context) { } resp := &values.GameSearchResp{} a.Data = resp - // var list, tmp []*common.ConfigGameList - // tmp = call.GetConfigGameList(0, req.Name) - // - // if len(req.Name) > 0 { - // reqName := strings.ToLower(req.Name) - // for _, v := range tmp { - // if strings.Contains(strings.ToLower(v.Name), reqName) { - // list = append(list, v) - // } - // } - // } else { - // list = tmp - // } - // - // start := req.Page * req.Num - // end := (req.Page + 1) * req.Num - // - // if start > len(list)-1 { - // return - // } - // if end > len(list) { - // end = len(list) - // } - // resp.List = list[start:end] - // for _, v := range resp.List { - // v.Jackpot = call.GetJackpot(common.JackpotTypeGame, v.GameID) - // } + list := call.GetConfigGameListByName(req.Name) + start := req.Page * req.Num + end := (req.Page + 1) * req.Num + if start > len(list)-1 { + return + } + if end > len(list) { + end = len(list) + } + resp.List = list[start:end] }