修改代码

dev_aagame_provider
zhora 1 month ago
parent 614e42e956
commit 14cd5f90c8
  1. 35
      call/config.go
  2. 10
      modules/web/handler/recharge.go

@ -3,6 +3,7 @@ package call
import (
"encoding/json"
"errors"
"fmt"
jsoniter "github.com/json-iterator/go"
"net"
"server/common"
@ -1469,7 +1470,17 @@ func GetConfigFirstPay() []*common.ConfigFirstPay {
return configFirstPay
}
func GetConfigFirstPayByCount(amount int64, buyCount int) (per int64, topThree bool) {
func GetConfigFirstPayByCount(amount int64, buyCountMap map[string]int) (times int, per int64, topThree bool) {
var buyCount int
if buyCountMap != nil {
// todo 一个额度一个首充计算
buyCount = buyCountMap[fmt.Sprintf("%d", amount)]
//// todo 全部额度公用一个首充计算
//for _, count := range buyCountMap {
// buyCount += count
//}
times = buyCount
}
for _, v := range configFirstPay {
if v.Amount == amount {
switch buyCount {
@ -1491,28 +1502,6 @@ func GetConfigFirstPayByCount(amount int64, buyCount int) (per int64, topThree b
return
}
func GetConfigFirstPayLevelByAmount(amount int64) int {
for _, v := range configFirstPay {
if amount >= v.Amount {
return v.Level
}
}
return 0
}
func GetConfigFirstPayPerByAmount(first bool, amount int64) int64 {
for i := len(configFirstPay) - 1; i >= 0; i-- {
v := configFirstPay[i]
if amount >= v.Amount {
if first {
return v.FirstPer
}
return v.Per
}
}
return 0
}
// LoadConfigActivityFreeSpin 每日免费转盘配置
func LoadConfigActivityFreeSpin() (err error) {
one := []*common.ConfigActivityFreeSpin{}

@ -2,7 +2,6 @@ package handler
import (
"encoding/json"
"fmt"
"server/call"
"server/config"
"server/db"
@ -49,7 +48,7 @@ func RechargeInfoFirst(c *gin.Context) {
rechargeInfo := call.GetRechargeInfo(a.UID)
for _, v := range call.GetConfigFirstPay() {
var bonus int64
per, _ := call.GetConfigFirstPayByCount(v.Amount, rechargeInfo.BuyAmountDataMap[fmt.Sprintf("%d", v.Amount)])
_, per, _ := call.GetConfigFirstPayByCount(v.Amount, rechargeInfo.BuyAmountDataMap)
if per > 0 {
bonus = v.Amount * per / 100
}
@ -121,8 +120,7 @@ func RechargeInfo(c *gin.Context) {
}
}
}
count := rechargeInfo.BuyAmountDataMap[fmt.Sprintf("%d", one.Amount)]
if bonus, _ := call.GetConfigFirstPayByCount(one.Amount, count); bonus > 0 {
if _, bonus, _ := call.GetConfigFirstPayByCount(one.Amount, rechargeInfo.BuyAmountDataMap); bonus > 0 {
one.Bonus = bonus * one.Amount / 100
}
resp.List = append(resp.List, one)
@ -338,11 +336,11 @@ func NewRechargeImp(req *values.RechargeReq, uid, cid int, ip string) *RechargeI
//per := call.GetConfigFirstPayPerByAmount(notCharge, order.Amount)
var times int
if req.Bonus && req.ActivityID == 0 {
times = re.BuyAmountDataMap[fmt.Sprintf("%d", order.Amount)]
per, topThree := call.GetConfigFirstPayByCount(order.Amount, times)
buyCount, per, topThree := call.GetConfigFirstPayByCount(order.Amount, re.BuyAmountDataMap)
if per > 0 {
order.Bonus = order.Amount * per / 100
}
times = buyCount
if topThree {
times++
} else {

Loading…
Cancel
Save