diff --git a/modules/web/app/balance.go b/modules/web/app/balance.go index 1259f0c..c46d4b2 100644 --- a/modules/web/app/balance.go +++ b/modules/web/app/balance.go @@ -25,8 +25,13 @@ func (g *Gin) CheckWithdrawCondition(amount int64, t common.CurrencyType) (ok bo g.Msg = "You have not completed the required bets yet. Before making an extraction it should be done." return } + con := call.GetVipCon(g.UID) + if con == nil { + g.Code = values.CodeWithdrawCondition + return + } vip := call.GetVIP(g.UID) - if vip.Level == 0 { + if vip.Level == 0 && con.WithdrawCount == 0 { var limit int64 = 20 if con := call.GetConfigVIPByLevel(1); con != nil { limit = con.Exp / common.DecimalDigits @@ -36,20 +41,27 @@ func (g *Gin) CheckWithdrawCondition(amount int64, t common.CurrencyType) (ok bo return } re := call.GetRechargeInfo(g.UID) - con := call.GetVipCon(g.UID) - if con == nil { - g.Code = values.CodeWithdrawCondition - return - } - if re.DayWithdraw+amount >= int64(con.WithdrawAmount) { + withdrawAmount := re.DayWithdraw + amount + withdrawCount := re.WithdrawCount + if con.Level == 0 { + withdrawAmount = re.TotalWithdraw + amount + withdrawCount = int(re.TotalWithdrawCount) + } + if withdrawAmount >= int64(con.WithdrawAmount) { g.Code = values.CodeWithdrawLimit - g.Msg = "Clearance amount has reached today!" + g.Msg = "Clearance amount has reached" + if vip.Level > 0 { + g.Msg += " today!" + } return } - if re.WithdrawCount >= con.WithdrawCount { + if withdrawCount >= con.WithdrawCount { g.Code = values.CodeWithdrawLimit - g.Msg = "Clearance count has reached today!" + g.Msg = "Clearance count has reached" + if vip.Level > 0 { + g.Msg += " today!" + } return }