支付需求开发

dev
mofangmin 1 year ago
parent d51ee18677
commit eef18c22d3
  1. 16
      call/config.go
  2. 2
      call/pay.go
  3. 11
      call/redis.go
  4. 4
      cmd/build.sh
  5. 9
      common/redis_keys.go
  6. 4
      modules/pay/gopay/values.go
  7. 19
      modules/web/handler/firstpage.go
  8. 16
      modules/web/handler/game.go
  9. 3
      modules/web/handler/recharge.go

@ -732,7 +732,21 @@ func GetConfigGameList(num int, cond ...int) []*common.ConfigGameList {
if v.GameProvider == common.ProviderPG2 || v.GameProvider == common.ProviderJiLi2 {
continue
}
ret = append(ret, v)
provider := -1
if v.GameProvider == common.ProviderJili {
provider = common.ProviderJiLi2
} else if v.GameProvider == common.ProviderPGSoft {
provider = common.ProviderPG2
}
if provider != -1 {
game := GetConfigGameListByGameID(provider, v.GameID)
if game != nil {
ret = append(ret, v)
continue
}
} else {
ret = append(ret, v)
}
}
sort.Slice(ret, func(i, j int) bool {
return ret[i].Sort > ret[j].Sort

@ -259,7 +259,7 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s
SendMailWithContent(uid, SystemTitle, fmt.Sprintf(EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits))
} else if nextTicket.ID > 0 {
AddUserDiscountTicket(uid, nextTicket.DiscountAmount, nextTicket.RechargeAmount, -1, 1, true)
SendMailWithContent(uid, SystemTitle, fmt.Sprintf(EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits))
SendMailWithContent(uid, SystemTitle, fmt.Sprintf(EmailDiscount, nextTicket.DiscountAmount/common.DecimalDigits, nextTicket.RechargeAmount/common.DecimalDigits))
}
}
}

@ -15,6 +15,14 @@ func AddChannel(channelID int, isSuccess bool) {
totalKey := fmt.Sprintf("channel_total_%v", channelID)
successKey := fmt.Sprintf("channel_success_%v", channelID)
// 检查键是否存在,如果不存在则设置过期时间
if client.Exists(ctx, totalKey).Val() == 0 {
client.Set(ctx, totalKey, 0, 10*time.Minute)
}
if client.Exists(ctx, successKey).Val() == 0 {
client.Set(ctx, successKey, 0, 10*time.Minute)
}
// 增加总订单数
client.Incr(ctx, totalKey)
@ -23,9 +31,6 @@ func AddChannel(channelID int, isSuccess bool) {
client.Incr(ctx, successKey)
}
// 设置过期时间为10分钟
client.Expire(ctx, totalKey, 10*time.Minute)
client.Expire(ctx, successKey, 10*time.Minute)
}
// GetChannelStatus 获取渠道状态

@ -8,5 +8,5 @@ cd pb/proto
# go generate
cd ../..
#go build main.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o indiaprovider main.go
#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gameserver main.go
#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o indiaprovider main.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gameserver main.go

@ -44,9 +44,10 @@ const (
RedisKeyRealMail = "realMail" // 给玩家发真实邮件控制
// RedisKeyPlayerPay = "playerPay" // 玩家10分钟内付费拉起的渠道记录
RedisKeyPlayerPayInterval = "playerPayInterval" // 玩家拉单间隔限制
RedisKeyGameCurrency = "gameCurrency" // 玩家进入游戏时选择的币种
RedisKeyPlayerRTP = "playerRtp" // 玩家RTP
RedisKeyChannelOrder = "channelOrder" //
RedisKeyPlayerPayCount = "playerPayIntervalCount"
RedisKeyGameCurrency = "gameCurrency" // 玩家进入游戏时选择的币种
RedisKeyPlayerRTP = "playerRtp" // 玩家RTP
RedisKeyChannelOrder = "channelOrder" //
)
const (
@ -60,7 +61,7 @@ func GetRedisKeyGameCurrency(uid int) string {
}
func GetRedisKeyPlayerPayCount(uid int) string {
return fmt.Sprintf("%v:%v:%v", RedisKeyPlayerPayInterval, uid)
return fmt.Sprintf("%v:%v:%v", RedisKeyPlayerPayCount, uid)
}
func GetRedisKeyPlayerChannelPayInterval(channel, uid int) string {
return fmt.Sprintf("%v:%v:%v", RedisKeyPlayerPayInterval, uid, channel)

@ -1,8 +1,8 @@
package gopay
const (
payURL = "https://gooopay.online/api/recharge/create"
withdrawURL = "https://gooopay.online/api/deposit/create"
payURL = "https://rummylotus.online/api/recharge/create"
withdrawURL = "https://rummylotus.online/api/deposit/create"
mid = "2024100038"
key = "326eb5a2f78a4dacb4780104ba16030c"
)

@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"math/rand"
"server/call"
"server/common"
"server/db"
@ -65,16 +66,20 @@ func FirstPage(c *gin.Context) {
gameNum := req.GameNum
if strings.ToLower(v.Name) == "hot" {
gameNum = 100
}
if v.JumpType == 1 {
one.List = call.GetConfigGameList(gameNum, v.JumpID)
if v.JumpType == 1 {
one.List = call.GetConfigGameList(gameNum, v.JumpID)
} else {
one.List = call.GetConfigGameList(gameNum, 0, v.JumpID)
}
} else {
one.List = call.GetConfigGameList(gameNum, 0, v.JumpID)
one.List = call.GetConfigGameList(0, 0)
rand.Shuffle(len(one.List), func(i, j int) {
one.List[i], one.List[j] = one.List[j], one.List[i]
})
}
if gameNum != req.GameNum {
// rand.Shuffle(len(one.List), func(i, j int) {
// one.List[i], one.List[j] = one.List[j], one.List[i]
// })
if len(one.List) > req.GameNum {
one.List = one.List[:req.GameNum]
}

@ -2,6 +2,7 @@ package handler
import (
"fmt"
"math/rand"
"server/call"
"server/common"
"server/db"
@ -29,16 +30,31 @@ func GameList(c *gin.Context) {
resp := &values.GameListResp{Provider: req.Provider}
a.Data = resp
var list, tmp []*common.ConfigGameList
var randFlag bool
if req.Provider == -1 {
req.Provider = 0
}
if req.Mark == -1 {
req.Mark = 0
} else {
req.Mark = 0
randFlag = true
}
if req.Type == -1 || req.Type == 1 {
req.Type = 0
}
// if req.Provider == -1 {
// req.Provider = 0
// randFlag = true
// }
tmp = call.GetConfigGameList(0, req.Provider, req.Mark, req.Type)
if randFlag {
rand.Shuffle(len(tmp), func(i, j int) {
tmp[i], tmp[j] = tmp[j], tmp[i]
})
}
if len(req.Name) > 0 {
reqName := strings.ToLower(req.Name)
for _, v := range tmp {

@ -151,7 +151,6 @@ func PlayerRecharge(c *gin.Context) {
return
}
log.Debug("player %v recharge:%+v", a.UID, *req)
call.AddChannel(req.PayChannel, false)
if req.CurrencyType == 0 {
req.CurrencyType = common.CurrencyINR
}
@ -172,6 +171,8 @@ func PlayerRecharge(c *gin.Context) {
a.Msg = "Requests are too frequent, please try again later"
return
}
call.AddChannel(req.PayChannel, false)
// if req.UserPhone == "" {
// req.UserPhone = util.CheckPhone(req.UserPhone)
// }

Loading…
Cancel
Save