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("दर्ज की गई राशि R$ के बीच होनी चाहिए %s और %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 = "आपने अभी तक आवश्यक दांव पूरे नहीं किए हैं। निकासी करने से पहले यह किया जाना चाहिए।" 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("अपर्याप्त वीआईपी स्तर आपकी टॉप-अप राशि R( $ %d VIP1 बनने और अपना पैसा निकालने में सक्षम होने के लिए.", limit) return } re := call.GetRechargeInfo(g.UID) con := call.GetVipCon(g.UID) if con == nil { g.Code = values.CodeWithdrawCondition return } // if re.DayWithdraw+amount >= con.WithdrawLimit || re.WithdrawCount+1 >= con.WithdrawCount { if re.WithdrawCount >= con.WithdrawCount { g.Code = values.CodeWithdrawLimit g.Msg = "निकासी की संख्या आज तक पहुंच गई है।" 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 }