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.
69 lines
1.9 KiB
69 lines
1.9 KiB
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("O valor inserido deve estar entre R$ %s e R$ %s.", util.FormatNumberBrazil(float64(down)/common.DecimalDigits), util.FormatNumberBrazil(float64(up)/common.DecimalDigits)) |
|
return |
|
} |
|
// 拉取当前所需下注 |
|
bet := call.GetUserNeedBet(g.UID) |
|
if bet > 0 { |
|
g.Code = values.CodeWithdrawConditionBet |
|
g.Msg = "Ainda não completou as apostas necessárias. É necessário fazê-lo antes de efetuar um levantamento." |
|
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("Nível VIP insuficiente Seu valor de recarga deve chegar a R( $ %d para se tornar um VIP1 e poder sacar seu dinheiro.", limit) |
|
return |
|
} |
|
// con := call.GetVipCon(g.UID) |
|
// if con == nil { |
|
// g.Code = values.CodeWithdrawCondition |
|
// return |
|
// } |
|
// if re.DayWithdraw+amount >= con.WithdrawLimit || re.WithdrawCount+1 >= con.WithdrawCount { |
|
// g.Code = values.CodeWithdrawLimit |
|
// return |
|
// } |
|
|
|
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 |
|
}
|
|
|