印度包网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.1 KiB

1 year ago
package app
import (
"fmt"
"server/call"
"server/common"
"server/db"
"server/modules/web/values"
"server/util"
)
// CheckWithdrawCondition 判断是否满足退出的配置条件
func (g *Gin) CheckWithdrawCondition(amount int64, t common.CurrencyType) (ok bool) {
down, up := call.GetConfigWithdrawLimits()
if amount < down || amount > up {
g.Code = values.CodeWithdrawCondition
g.Msg = fmt.Sprintf("The amount entered should be between $%s and %s.", util.FormatNumberBrazil(float64(down)/common.DecimalDigits), util.FormatNumberBrazil(float64(up)/common.DecimalDigits))
1 year ago
return
}
// 拉取当前所需下注
bet := call.GetUserNeedBet(g.UID)
if bet > 0 {
g.Code = values.CodeWithdrawConditionBet
g.Msg = "You have not completed the required bets yet. Before making an extraction it should be done."
1 year ago
return
}
vip := call.GetVIP(g.UID)
if vip.Level == 0 {
var limit int64 = 20
if con := call.GetConfigVIPByLevel(1); con != nil {
limit = con.Exp / common.DecimalDigits
}
g.Code = values.CodeWithdrawConditionVip
g.Msg = fmt.Sprintf("Insufficient VIP levels your topup amount ($%d to become vip1 and be able to withdraw your money.", limit)
1 year ago
return
}
re := call.GetRechargeInfo(g.UID)
con := call.GetVipCon(g.UID)
if con == nil {
g.Code = values.CodeWithdrawCondition
return
}
3 months ago
if re.DayWithdraw+amount >= int64(con.WithdrawAmount) {
g.Code = values.CodeWithdrawLimit
g.Msg = "Clearance amount has reached today!"
return
}
if re.WithdrawCount >= con.WithdrawCount {
g.Code = values.CodeWithdrawLimit
g.Msg = "Clearance count has reached today!"
return
}
1 year ago
ok = true
return
}
// CanBuyProduct 判断是否满足可以购买该商品
func (g *Gin) CanBuyProduct(actID, pid int) (can bool) {
if actID == 0 || actID < common.ProductTypeAll {
return true
}
if !g.CheckActivityExpire(actID) {
return
}
switch actID {
case common.ActivityIDRecharge:
one := &common.RechargeInfo{UID: g.UID}
db.Mysql().Get(one)
if common.GetProductPayCount(one.ProductPayCount, pid) >= 1 {
g.Code = values.CodeBuyLimit
return
}
}
return true
}