补充逻辑

dev_aagame_provider
zhora 2 months ago
parent b0650c9915
commit 41ab2ba1b9
  1. 26
      call/config.go
  2. 4
      call/pay.go
  3. 47
      call/rank.go
  4. 14
      call/share.go
  5. 15
      call/user.go
  6. 2
      common/currency.go
  7. 3
      common/email.go
  8. 1
      common/rank.go
  9. 2
      common/recharge.go
  10. 2
      db/mysql/mysql_mail.go
  11. BIN
      indiaprovider
  12. 7
      modules/backend/handler/mail/mail.go
  13. 2
      modules/backend/handler/statistics/rechargeOrderList.go
  14. 2
      modules/backend/values/protocol.go
  15. 4
      modules/web/app/balance.go
  16. 29
      modules/web/handler/account.go
  17. 5
      modules/web/handler/balance.go
  18. 9
      modules/web/handler/luckyWheel.go
  19. 5
      modules/web/handler/pdd.go
  20. 6
      modules/web/handler/rank.go
  21. 14
      modules/web/handler/recharge.go
  22. 12
      modules/web/handler/user.go
  23. 13
      modules/web/handler/vip.go
  24. 75
      modules/web/handler/withdraw.go
  25. 2
      modules/web/providers/jin2/values.go
  26. 7
      modules/web/values/pay.go
  27. 3
      modules/web/values/protocol.go

@ -359,6 +359,20 @@ func GetConfigPayProductByID(id int) *common.ConfigPayProduct {
return nil
}
func GetConfigPayProductByAmount(amount int64) *common.ConfigPayProduct {
if len(configPayProduct) == 0 {
if err := LoadConfigPayProduct(); err != nil {
return nil
}
}
for _, v := range configPayProduct {
if v.Amount == amount {
return v
}
}
return nil
}
func GetConfigPayProductByActivityID(actID int) []*common.ConfigPayProduct {
ret := []*common.ConfigPayProduct{}
for _, v := range configPayProduct {
@ -488,6 +502,18 @@ func GetConfigVIP() []*common.ConfigVIP {
return result
}
func GetConfigVIPWithout0() []*common.ConfigVIP {
result := make([]*common.ConfigVIP, 0, len(configVIP)-1)
for _, v := range configVIP {
if v.Level == 0 {
continue
}
tmpV := *v
result = append(result, &tmpV)
}
return result
}
// GetConfigVIPByLevel 获取vip配置
func GetConfigVIPByLevel(level int) *common.ConfigVIP {
for _, v := range configVIP {

@ -45,7 +45,7 @@ func GetRechargeInfo(uid int) *common.RechargeInfo {
jsoniter.UnmarshalFromString(info.BuyAmountData, &info.BuyAmountDataMap)
}
if info.BuyAmountDataMap == nil {
info.BuyAmountDataMap = make(map[int64]int)
info.BuyAmountDataMap = make(map[string]int)
}
return info
}
@ -161,7 +161,7 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s
// 第二步,更新recharge_info
payData := &common.ESPlayerPayData{UID: uid, Channel: r.ChannelID, Type: 1, CurrencyType: r.CurrencyType}
if topThree {
re.BuyAmountDataMap[r.Amount]++
re.BuyAmountDataMap[fmt.Sprintf("%d", r.Amount)]++
}
amountCountByte, _ := json.Marshal(re.BuyAmountDataMap)
amountCountData := string(amountCountByte)

@ -2,7 +2,6 @@ package call
import (
"context"
"encoding/json"
"fmt"
"github.com/liangdas/mqant/log"
"gorm.io/gorm"
@ -85,11 +84,11 @@ func RankHandler() {
for rankCycle := range rank.RankCycleMap {
switch rankCycle {
case "1":
awardAt = util.GetZeroTime(now.AddDate(0, 0, 1)).Add(time.Hour)
awardAt = util.GetZeroTime(now.AddDate(0, 0, 1)).Add(30 * time.Minute)
case "2":
awardAt = util.GetWeekZeroTime(now).AddDate(0, 0, 7).Add(2 * time.Hour)
awardAt = util.GetWeekZeroTime(now).AddDate(0, 0, 7).Add(45 * time.Minute)
case "3":
awardAt = util.GetFirstDateOfMonth(now).AddDate(0, 1, 0).Add(2 * time.Hour)
awardAt = util.GetFirstDateOfMonth(now).AddDate(0, 1, 0).Add(60 * time.Minute)
}
if awardAt.IsZero() {
log.Error("get award time err, %+v, %s", *rank, rankCycle)
@ -194,10 +193,22 @@ func rankAward(ticker *rankTicker) {
if userAwardCount == 0 {
continue
}
awardData, _ := json.Marshal(common.CurrencyPair{
if rankData.IsRobot == 1 {
continue
}
_, err = UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{
UID: rankData.UID,
Type: common.CurrencyINR,
Value: userAwardCount,
Event: common.CurrencyEventRankAward,
NeedBet: GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, userAwardCount),
},
})
if err != nil {
log.Error("rank award err, %s", err.Error())
}
var rankCycle string
switch ticker.rankCycle {
case "1":
@ -215,7 +226,6 @@ func rankAward(ticker *rankTicker) {
Type: 1,
Title: fmt.Sprintf("%s Rank Rankings settlement(%s)", rankCycle, rankAt.Format("20060102")),
Content: fmt.Sprintf("Nice work! You ranked %dth on the betting leaderboard and earned a reward. Go claim it now!", rank),
Enc: string(awardData),
SendMethod: 1,
Status: common.MailStatusNew,
Time: now.Unix(),
@ -228,10 +238,23 @@ func rankAward(ticker *rankTicker) {
// 重置上一期奖池数量
preJackpotLessKey := jackpotKey + "|less"
log.Debug("rankAward, %s, %d, less jackpot:%d", jackpotKey, jackpot, lessJackpot)
err = db.Redis().GetRedis().Set(context.Background(), preJackpotLessKey, lessJackpot, time.Hour*24*30*2).Err()
if lessJackpot < 0 {
lessJackpot = 0
}
err = db.Redis().GetRedis().Set(context.Background(), preJackpotLessKey, lessJackpot, 0).Err()
if err != nil {
log.Error("share rankAward, %s set less-jackpot err, %s", preJackpotLessKey, err.Error())
}
var expire int64
switch ticker.rankCycle {
case "1":
expire = 24 * 60 * 60 * 2
case "2":
expire = 24 * 60 * 60 * 7 * 2
case "3":
expire = 24 * 60 * 60 * 30 * 2
}
db.Redis().Expire(preJackpotLessKey, time.Duration(expire)*time.Second)
if lessJackpot > 0 {
_, _, _, jackpotKeyNow := getRankJackpotKey(rankConfig.RankType, ticker.rankCycle)
_, err = db.Redis().Incr(jackpotKeyNow, lessJackpot)
@ -263,11 +286,13 @@ func UpdateRankValue(mode int, uid int, updateValue int64, isRobot int) {
RankCycle: util.ToInt(rankCycle),
RankAt: rankAt.Unix(),
IsRobot: isRobot,
TotalBet: updateValue,
RankValue: updateValueReal,
UpdatedAt: now.Unix(),
}
updates := map[string]interface{}{
"total_bet": gorm.Expr(fmt.Sprintf("total_bet + %d", rankData.TotalBet)),
"rank_value": gorm.Expr(fmt.Sprintf("rank_value + %d", rankData.RankValue)),
"updated_at": rankData.UpdatedAt,
}
@ -455,6 +480,14 @@ func rankUsersGet(rankType int, rankCycle string, rankAt time.Time, page, pageSi
log.Error("get rank user with info err, %s", err.Error())
return
}
cfg := GetConfigRankByCycle(rankType, rankCycle)
for _, rankUser := range rankUsers {
if rankUser.TotalBet == 0 {
rankUser.RankValue = rankUser.RankValue * 10000 / int64(cfg.FreeRatesMap[rankCycle])
} else {
rankUser.RankValue = rankUser.TotalBet
}
}
return
}

@ -2,7 +2,6 @@ package call
import (
"context"
"encoding/json"
"fmt"
"gorm.io/gorm/clause"
"reflect"
@ -708,11 +707,19 @@ func shareRankAward() {
if userAwardCount == 0 {
continue
}
awardData, _ := json.Marshal(common.CurrencyPair{
_, err = UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{
UID: rankUser.UID,
Type: common.CurrencyINR,
Value: userAwardCount,
Event: common.CurrencyEventShareRankAward,
NeedBet: GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, userAwardCount),
},
})
// todo 给玩家邮件发奖
if err != nil {
log.Error("share rank award err, %s", err.Error())
}
mail := common.Mail{
DraftID: "",
Sender: "system",
@ -720,7 +727,6 @@ func shareRankAward() {
Type: 1,
Title: fmt.Sprintf("EARN RANKING(%s)", lastRankAt.Format("20060102")),
Content: fmt.Sprintf("Well done! You ranked %dth on the invitation leaderboard and won a reward. Go claim it now!", rank),
Enc: string(awardData),
SendMethod: 1,
Status: common.MailStatusNew,
Time: now.Unix(),

@ -302,12 +302,12 @@ func InsertLoginRecord(uid, channel int, ip string, birth int64, deviceType int)
}
func GetVIP(uid int) *common.VipData {
data := &common.VipData{UID: uid}
err := db.Mysql().Get(data)
if err == gorm.ErrRecordNotFound {
re := &common.RechargeInfo{UID: uid}
db.Mysql().Get(re)
data := &common.VipData{UID: uid}
db.Mysql().Get(data)
data.Exp = re.TotalRecharge
if data.ID == 0 {
if data.Exp > 0 {
cons := GetConfigVIP()
for i := len(cons) - 1; i >= 0; i-- {
@ -332,8 +332,8 @@ func GetVIP(uid int) *common.VipData {
func GetVipCon(uid int) *common.ConfigVIP {
data := &common.VipData{UID: uid}
err := db.Mysql().Get(data)
if err == gorm.ErrRecordNotFound {
db.Mysql().Get(data)
if data.ID == 0 {
util.Go(func() {
db.Mysql().Create(data)
})
@ -343,8 +343,8 @@ func GetVipCon(uid int) *common.ConfigVIP {
func GetVipLevel(exp, bet int64) int {
con := GetConfigVIP()
for i := len(con) - 2; i >= 0; i-- {
if con[i].Exp > 0 && exp >= con[i].Exp { // 升级
for i := len(con) - 1; i >= 0; i-- {
if con[i].Exp >= 0 && exp >= con[i].Exp { // 升级
return con[i].Level
}
}
@ -501,6 +501,7 @@ func GetUserCurrencyRecharge(uid int, t common.CurrencyType) int64 {
// 获取充值账户+赢钱账户的总额
func GetUserCurrencyTotal(uid int, t common.CurrencyType) int64 {
t = common.CurrencyINR
var pc, pcr int64
db.Mysql().C().Model(&common.PlayerCurrency{UID: uid}).Select(t.GetCurrencyName()).Scan(&pc)
db.Mysql().C().Table(common.PlayerRechargeTableName).Where("uid = ?", uid).Select(t.GetCurrencyName()).Scan(&pcr)

@ -111,6 +111,8 @@ const (
CurrencyEventVIPWeekBonus // 领取vip周奖励
CurrencyEventShare
CurrencyEventShareBeInvite // 分享被邀请
CurrencyEventRankAward // 打码排行榜奖励
CurrencyEventShareRankAward // 分享排行榜奖励
CurrencyEventAll
CurrencyEventGM = 1000 // 后台修改货币

@ -53,6 +53,7 @@ type Mail struct {
Time int64 `gorm:"column:time;type:bigint(20);default:0;comment:收到邮件时间" json:"Time"`
// 0:全部用户, 1:xx时间前注册用户, 2:有充值用户, 3:新用户(当天注册用户), 4:老用户(非当天注册用户), 5:累计充值达到多少的用户, 6:某渠道用户
UserTag int `gorm:"column:user_tag;type:int(11);default:0;comment:用户tag" json:"UserTag"`
Tag int `gorm:"column:tag;type:int(11);default:0;comment:邮箱tag" json:"Tag"`
MaxBirthAt int64 `gorm:"column:max_birth_at;type:bigint(20);default:0;comment:最大出生玩家" json:"MaxBirthAt"`
RechargeAmount int64 `gorm:"column:recharge_amount;type:int(11);default:0;comment:充值额度限制" json:"RechargeAmount"`
ChannelId string `gorm:"column:channel_id;type:varchar(512);default:'';comment:渠道列表" json:"ChannelId"`
@ -100,4 +101,6 @@ type MailDraft struct {
RechargeAmount int64
ChannelId string
URL string
Tag int
}

@ -53,6 +53,7 @@ type RankData struct {
RankCycle int `gorm:"column:rank_cycle;type:int(11);not null;uniqueIndex:rank_idx,priority:2;comment:排行榜周期(1:日,2:周,3:月)" json:"rank_cycle"` // 排行榜周期(1:日,2:周,3:月)
RankAt int64 `gorm:"column:rank_at;type:bigint(20);not null;uniqueIndex:rank_idx,priority:3;comment:排行榜开始日期" json:"rank_at"` // 排行榜开始日期
RankValue int64 `gorm:"column:rank_value;type:bigint(20);not null;comment:玩家数值" json:"rank_value"` // 玩家数值
TotalBet int64 `gorm:"column:total_bet;type:bigint(20);default:0;comment:玩家总下注值" json:"total_bet"` // 玩家总下注值
IsRobot int `gorm:"column:is_robot;type:int(11);not null;comment:是不是机器人(0:不是,1:是)" json:"is_robot"` // 是不是机器人(0:不是,1:是)
UserAward int `gorm:"column:user_award;type:int(11);not null;comment:玩家奖励比例(*10000)" json:"user_award"` // 玩家奖励比例(*10000)
UserAwardCount int64 `gorm:"column:user_award_count;type:bigint(20);not null;comment:玩家奖励数量" json:"user_award_count"` // 玩家奖励数量

@ -211,7 +211,7 @@ type RechargeInfo struct {
WithdrawCount int `gorm:"column:withdraw_count;type:int(11);default:0;comment:当天累计退出次数"`
WithdrawingCash int64 `gorm:"column:withdrawing_cash;type:bigint(20);default:0;comment:提现中的金币" json:"withdrawing_cash"`
BuyAmountData string `gorm:"column:buy_amount_data;default:'';type:varchar(1024);comment:购买额度信息"` // 购买额度信息
BuyAmountDataMap map[int64]int `gorm:"-"`
BuyAmountDataMap map[string]int `gorm:"-"`
}
func (r *RechargeInfo) TableName() string {

@ -30,9 +30,7 @@ func (c *MysqlClient) QueryMailList(uid, page, num int, birth, channelId, rechar
rechargeAmount,
channelId,
)
if tag != 0 {
sql += fmt.Sprintf(" and `tag` = %d ", tag)
}
count, err = c.QueryList(page, num, sql, "status,time desc", &common.Mail{}, &list)
if count > common.MailMaxCount {
count = common.MailMaxCount

Binary file not shown.

@ -92,6 +92,7 @@ func DraftCreate(c *gin.Context) {
save.RechargeAmount = req.RechargeAmount
save.ChannelId = req.ChannelId
save.URL = req.URL
save.Tag = req.Tag
if err := db.ES().InsertToES(common.ESIndexBackMailDraft, save); err != nil {
log.Error("err:%v", err)
a.Code = values.CodeRetry
@ -179,6 +180,10 @@ func DraftEdit(c *gin.Context) {
update = true
one.URL = *req.URL
}
if req.Tag != nil {
update = true
one.Tag = *req.Tag
}
if !update {
a.Code = values.CodeParam
a.Msg = "无内容修改"
@ -260,6 +265,7 @@ func DraftOpt(c *gin.Context) {
mail.SendMethod = one.SendMethod
mail.Status = common.MailStatusNew
mail.URL = one.URL
mail.Tag = one.Tag
if one.SendMethod == common.MailSendMethodTiming {
mail.Time = one.SendTime
} else if one.SendMethod == common.MailSendMethodImmediately {
@ -290,6 +296,7 @@ func DraftOpt(c *gin.Context) {
mail.RechargeAmount = one.RechargeAmount
mail.ChannelId = one.ChannelId
mail.URL = one.URL
mail.Tag = one.Tag
if one.SendMethod == common.MailSendMethodTiming {
mail.Time = one.SendTime
} else if one.SendMethod == common.MailSendMethodImmediately {

@ -46,7 +46,7 @@ func RechargeOrderList(c *gin.Context) {
str += fmt.Sprintf(" AND status = %d", *req.Status)
}
queryOrder += " LEFT JOIN ( SELECT uid, SUM(amount) AS totalAmount FROM recharge_order WHERE " + str + " GROUP BY uid) rm ON rm.uid = re.uid "
queryOrder += " LEFT JOIN ( SELECT uid, COALESCE(SUM(amount), 0) AS totalAmount FROM recharge_order WHERE " + str + " GROUP BY uid) rm ON rm.uid = re.uid "
if req.Birth != nil {
birthSu, birthEu := utils.GetQueryUnix(*req.Birth, *req.Birth)

@ -44,6 +44,7 @@ type MailDraftCreateReq struct {
Enclosure []*common.CurrencyPair `json:"Enclosure" binding:"required"`
SendMethod int `json:"SendMethod" binding:"required"`
SendTime int64 `json:"SendTime"`
Tag int `json:"Tag"`
// 0:全部用户,1:xx时间前注册的用户,2:有充值用户,3:新用户(当天注册),4:老用户(非当天注册),5:累计充值达到x的用户,6:x渠道用户
UserTag int `json:"UserTag"`
// 最大注册日期,对应UserTag为1
@ -81,6 +82,7 @@ type MailDraftEditReq struct {
RechargeAmount *int64 `json:"RechargeAmount"`
ChannelId *string `json:"ChannelId"`
URL *string `json:"URL"`
Tag *int `json:"Tag"`
}
// MailDraftOptReq 操作草稿

@ -14,7 +14,7 @@ func (g *Gin) CheckWithdrawCondition(amount int64, t common.CurrencyType) (ok bo
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))
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))
return
}
// 拉取当前所需下注
@ -31,7 +31,7 @@ func (g *Gin) CheckWithdrawCondition(amount int64, t common.CurrencyType) (ok bo
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)
g.Msg = fmt.Sprintf("Insufficient VIP levels your topup amount (%d to become vip1 and be able to withdraw your money.", limit)
return
}
re := call.GetRechargeInfo(g.UID)

@ -100,7 +100,7 @@ func onLogin(user *common.PlayerDBInfo, a *app.Gin, isNew bool) {
return
}
userInfo, err := getUserInfo(user.Id)
userInfo, err := getUserInfo(user.Id, isNew)
if err != nil {
log.Error("get userInfo err, %s", err.Error())
a.Code = values.CodeRetry
@ -290,6 +290,7 @@ func PhoneResetPass(c *gin.Context) {
a.Code = values.CodeRetry
return
}
a.Msg = "Password reset successful"
}
func PhoneCodeLogin(c *gin.Context) {
@ -331,11 +332,9 @@ func BindingAccount(c *gin.Context) {
return
}
log.Debug("BindingAccount %+v", *req)
if req.Code != "123456" {
if !a.VerifyCode(req.Phone, req.Code) {
return
}
}
cid := a.Channel
if cid == 0 {
a.Code = values.CodeParam
@ -357,18 +356,18 @@ func BindingAccount(c *gin.Context) {
a.Code = values.CodeRetry
return
}
reward := call.GetConfigPlatform().BindPhoneGift
if reward > 0 {
call.UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{
UID: a.UID,
Event: common.CurrencyEventBindPhone,
Type: common.CurrencyINR,
Value: reward,
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward),
},
})
}
//reward := call.GetConfigPlatform().BindPhoneGift
//if reward > 0 {
// call.UpdateCurrencyPro(&common.UpdateCurrency{
// CurrencyBalance: &common.CurrencyBalance{
// UID: a.UID,
// Event: common.CurrencyEventBindPhone,
// Type: common.CurrencyINR,
// Value: reward,
// NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward),
// },
// })
//}
}
func GPLogin(c *gin.Context) {

@ -51,6 +51,11 @@ func BalanceHistory(c *gin.Context) {
// q.MustNot(elastic.NewMatchQuery("event", common.CurrencyEventGameBetReturn), elastic.NewMatchQuery("event", common.CurrencyEventGameBet),
// elastic.NewMatchQuery("event", common.CurrencyEventGameSettleReturn))
q.Filter(elastic.NewRangeQuery("uid").Gte(a.UID), elastic.NewRangeQuery("uid").Lt(a.UID+1))
if req.Type == 1 {
q.Filter(elastic.NewRangeQuery("value").Gt(0))
} else if req.Type == 2 {
q.Filter(elastic.NewRangeQuery("value").Lt(0))
}
player, _ := call.GetUserXInfo(a.UID, "birth")
if start < player.Birth {
start = player.Birth

@ -49,13 +49,16 @@ func LuckyWheelCfg(c *gin.Context) {
)
for _, wheelCfg := range luckyWheel.WheelCfgStr {
if wheelCfg.LuckyType == 4 &&
rechargeInfo.TotalRecharge < int64(wheelCfg.RechargeAmount[0]) { // 特殊转盘达到了才能看见
rechargeInfo.TotalRecharge < int64(wheelCfg.RechargeAmount[0]*common.DecimalDigits) { // 特殊转盘达到了才能看见
continue
}
lessKey := fmt.Sprintf("l%d", wheelCfg.LuckyType)
for _, rechargeAmount := range wheelCfg.RechargeAmount {
if rechargeAmount == 0 {
continue
}
freeKey := fmt.Sprintf("f%d_%d", wheelCfg.LuckyType, rechargeAmount)
if rechargeInfo.TotalRecharge >= int64(rechargeAmount) &&
if rechargeInfo.TotalRecharge >= int64(rechargeAmount)*common.DecimalDigits &&
playerData.LuckyWheelMap[freeKey] == 0 {
playerData.LuckyWheelMap[freeKey] = 1
playerData.LuckyWheelMap[lessKey] += 1
@ -116,7 +119,7 @@ func LuckyWheelLottery(c *gin.Context) {
rechargeInfo := call.GetRechargeInfo(uid)
for _, v := range luckyWheel.WheelCfgStr {
if v.LuckyType == req.LuckyType {
if rechargeInfo.TotalRecharge < int64(v.RechargeAmount[0]) {
if rechargeInfo.TotalRecharge < int64(v.RechargeAmount[0]*common.DecimalDigits) {
a.Code = values.CodeParam
a.Msg = "Not enough recharge."
return

@ -162,6 +162,7 @@ func PddLottery(c *gin.Context) {
userAmount := util.ToFloat64(pddData.Amount)
if util.ToInt(userAmount) == pdd.WithdrawalAmount {
a.Code = values.CodeParam
a.Msg = "You can withdraw now."
return
}
updateValues := map[string]interface{}{
@ -297,8 +298,8 @@ func PddDraw(c *gin.Context) {
Event: common.CurrencyEventActivityPdd,
Type: common.CurrencyINR,
ChannelID: a.Channel,
Value: int64(pdd.WithdrawalAmount),
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, int64(pdd.WithdrawalAmount), pdd.BetMultiples),
Value: int64(pdd.WithdrawalAmount * common.DecimalDigits),
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, int64(pdd.WithdrawalAmount*common.DecimalDigits), pdd.BetMultiples),
},
})
if err != nil {

@ -27,7 +27,11 @@ func RankCfg(c *gin.Context) {
a.Data = resp
configRanks := call.GetConfigRank(req.RankType)
for _, configRank := range configRanks {
for rankCycle := range configRank.RankCycleMap {
for _, rankCycle := range []string{"1", "2", "3"} {
_, ok := configRank.RankCycleMap[rankCycle]
if !ok {
continue
}
jackpot, rankLess := call.RankJackpotGet(req.RankType, rankCycle)
rankData := values.RankData{
RankCycle: util.ToInt(rankCycle),

@ -2,6 +2,7 @@ package handler
import (
"encoding/json"
"fmt"
"server/call"
"server/config"
"server/db"
@ -48,13 +49,18 @@ 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[v.Amount])
per, _ := call.GetConfigFirstPayByCount(v.Amount, rechargeInfo.BuyAmountDataMap[fmt.Sprintf("%d", v.Amount)])
if per > 0 {
bonus = v.Amount * per / 100
}
var productId int
if product := call.GetConfigPayProductByAmount(v.Amount); product != nil {
productId = product.ProductID
}
resp.List = append(resp.List, values.PayInfo{
Amount: v.Amount,
Bonus: bonus,
ProductId: productId,
})
}
}
@ -115,7 +121,7 @@ func RechargeInfo(c *gin.Context) {
}
}
}
count := rechargeInfo.BuyAmountDataMap[one.Amount]
count := rechargeInfo.BuyAmountDataMap[fmt.Sprintf("%d", one.Amount)]
if bonus, _ := call.GetConfigFirstPayByCount(one.Amount, count); bonus > 0 {
one.Bonus = bonus * one.Amount / 100
}
@ -149,7 +155,7 @@ func RechargeInfo(c *gin.Context) {
}
resp.NeedBet = call.GetUserNeedBet(a.UID)
resp.Cash = int64(call.GetUserCurrencyFloat(a.UID, common.CurrencyType(0), 0))
resp.Cash = call.GetUserCurrencyTotal(a.UID, common.CurrencyType(0))
if resp.NeedBet == 0 {
resp.CanWithdraw = resp.Cash
}
@ -300,7 +306,7 @@ func NewRechargeImp(req *values.RechargeReq, uid, cid int, ip string) *RechargeI
//per := call.GetConfigFirstPayPerByAmount(notCharge, order.Amount)
var times int
if req.Bonus {
times = re.BuyAmountDataMap[order.Amount]
times = re.BuyAmountDataMap[fmt.Sprintf("%d", order.Amount)]
per, topThree := call.GetConfigFirstPayByCount(order.Amount, times)
if per > 0 {
order.Bonus = order.Amount * per / 100

@ -6,6 +6,7 @@ import (
"reflect"
"server/call"
"server/common"
"server/config"
"server/db"
"server/modules/web/app"
"server/modules/web/values"
@ -17,7 +18,7 @@ import (
"gorm.io/gorm"
)
func getUserInfo(uid int) (resp values.UserInfoResp, err error) {
func getUserInfo(uid int, isNew bool) (resp values.UserInfoResp, err error) {
pd := &common.PlayerData{UID: uid}
db.Mysql().Get(pd)
ret, err := call.GetUserXInfo(uid, "avatar", "nick", "mobile", "birth")
@ -60,6 +61,8 @@ func getUserInfo(uid int) (resp values.UserInfoResp, err error) {
resp.NextVip.WithdrawFee = nextVip.Fee
resp.NextVip.WithdrawCount = nextVip.WithdrawCount
resp.NextVip.WithdrawAmount = nextVip.WithdrawAmount
resp.NextVip.Exp = nextVip.Exp
resp.NextVip.Level = nextVip.Level
} else {
resp.NextVip = resp.CurrentVip
}
@ -76,6 +79,13 @@ func getUserInfo(uid int) (resp values.UserInfoResp, err error) {
}
resp.Currencys[i] = ref.Field(int(i) + 1).Int()
}
if isNew {
if value := call.GetUserCurrencyTotal(uid, common.CurrencyINR); value == 0 {
resp.Currencys[common.CurrencyINR] = config.GetConfig().Web.FreeSpinFirst
} else {
resp.Currencys[common.CurrencyINR] = value
}
}
re := &common.RechargeInfo{UID: uid}
db.Mysql().Get(re)
resp.Recharge = re.TotalRecharge

@ -30,7 +30,7 @@ func GetVipInfoNew(c *gin.Context) {
req.Num = 100
}
resp := &values.VipInfoResp{
List: call.GetConfigVIP(),
List: call.GetConfigVIPWithout0(),
}
a.Data = resp
a.GetUID()
@ -51,16 +51,17 @@ func GetVipInfoNew(c *gin.Context) {
return
}
var weekBonus bool
if con.BonusWeek != 0 {
if resp.Info.WeekBonusAt == 0 {
if con.BonusWeek != 0 { // 有周奖励
if resp.Info.WeekBonusAt == 0 { // 可以领取
weekBonus = true
} else {
weekBonus = util.IsSameWeek(time.Now().Unix(), resp.Info.WeekBonusAt)
weekBonus = !util.IsSameWeek(time.Now().Unix(), resp.Info.WeekBonusAt)
}
}
for _, v := range resp.List {
if util.SliceContain(levelBonus, v.Level) {
// 可领取
v.BonusDraw = 1
} else {
if v.Level <= resp.Info.Level {
@ -69,9 +70,9 @@ func GetVipInfoNew(c *gin.Context) {
}
if v.Level == resp.Info.Level {
if weekBonus {
v.BonusWeekDraw = 2
} else {
v.BonusWeekDraw = 1
} else {
v.BonusWeekDraw = 2
}
}
}

@ -153,8 +153,8 @@ func WithdrawInfo(c *gin.Context) {
a.Code = values.CodeRetry
return
}
resp := values.WithDrawInfoResp{Tips: call.GetConfigPlatform().WithdrawTips}
resp := &values.WithDrawInfoResp{Tips: call.GetConfigPlatform().WithdrawTips}
a.Data = resp
if util.IsSameDayTimeStamp(time.Now().Unix(), info.LastWithdraw) {
resp.WithDrawCount = info.WithdrawCount
} else {
@ -201,8 +201,14 @@ func WithdrawInfo(c *gin.Context) {
}
resp.Bets = append(resp.Bets, canWithdraw)
}
vipInfo := call.GetVIP(a.UID)
vipCfg := call.GetConfigVIPByLevel(vipInfo.Level)
resp.NeedBet = call.GetUserNeedBet(a.UID)
resp.Cash = int64(call.GetUserCurrencyFloat(a.UID, common.CurrencyType(0), 0))
if int64(vipCfg.WithdrawAmount)-info.DayWithdraw > 0 {
resp.WithdrawalLimit = int64(vipCfg.WithdrawAmount) - info.DayWithdraw
}
resp.Cash = call.GetUserCurrencyTotal(a.UID, common.CurrencyType(0))
if resp.NeedBet == 0 {
resp.CanWithdraw = resp.Cash
}
@ -216,14 +222,15 @@ func WithdrawInfo(c *gin.Context) {
if withdrawInfo.ID == 0 {
return
}
resp.WithdrawInfo.BankName = withdrawInfo.BankName
resp.WithdrawInfo.BankBranchName = withdrawInfo.BankBranchName
resp.WithdrawInfo.PhoneNumber = withdrawInfo.PhoneNumber
resp.WithdrawInfo.UserName = withdrawInfo.UserName
resp.WithdrawInfo.IFSCCode = withdrawInfo.IFSCCode
resp.WithdrawInfo.AccountNumber = withdrawInfo.AccountNumber
resp.WithdrawInfo.Email = withdrawInfo.Email
a.Data = resp
resp.WithdrawInfo = &values.WithdrawInfo{
BankName: withdrawInfo.BankName,
BankBranchName: withdrawInfo.BankBranchName,
PhoneNumber: withdrawInfo.PhoneNumber,
UserName: withdrawInfo.UserName,
IFSCCode: withdrawInfo.IFSCCode,
AccountNumber: withdrawInfo.AccountNumber,
Email: withdrawInfo.Email,
}
}
func WithdrawHistory(c *gin.Context) {
@ -238,29 +245,49 @@ func WithdrawHistory(c *gin.Context) {
if req.PageSize > 100 {
req.PageSize = 100
}
resp := &values.WithdrawHistoryResp{}
a.Data = resp
// log.Debug("withdraw history req:%+v", *req)
ret := []common.WithdrawOrder{}
var count int64
var count, totalAmount int64
var err error
count, err = db.Mysql().QueryListW(req.Page, req.PageSize, "create_time desc",
&common.WithdrawOrder{UID: a.UID}, &ret, "uid = ? and event = ?",
a.UID, common.CurrencyEventWithDraw)
mdb := db.Mysql().C().Model(&common.WithdrawOrder{}).Where("uid = ? and event = ?", a.UID, common.CurrencyEventWithDraw)
if req.StartAt != 0 && req.EndAt != 0 {
mdb = mdb.Where("create_time >= ? and create_time <= ?", req.StartAt, req.EndAt)
}
err = mdb.Count(&count).Error
if err != nil {
log.Error("err:%v", err)
a.Code = values.CodeRetry
return
log.Error("get count err, %s", err.Error())
}
err = mdb.Order("create_time desc").Offset(req.Page * req.PageSize).Limit(req.PageSize).Find(&ret).Error
if err != nil {
log.Error("get withdraw history err, %s", err.Error())
}
err = mdb.Select("COALESCE(SUM(amount), 0)").Scan(&totalAmount).Error
if err != nil {
log.Error("get total withdraw amount err, %s", err.Error())
}
resp.TotalAmount = totalAmount * common.DecimalDigits
for i, v := range ret {
ret[i].Amount *= common.DecimalDigits
var status uint8
if v.Status == common.StatusROrderCreate || v.Status == common.StatusROrderWaitting {
ret[i].Status = common.StatusROrderPay
status = 0
} else if v.Status == common.StatusROrderRefuse {
ret[i].Status = common.StatusROrderFail
}
status = 2
} else if v.Status == common.StatusROrderPay {
status = 1
}
resp := values.WithdrawHistoryResp{
Count: count,
List: ret,
ret[i].Status = status
}
resp.Count = count
resp.List = ret
a.Data = resp
}

@ -1,7 +1,7 @@
package jin2
const (
APIRlease = "https://gamecenter.fortureslots.com/api/v1/game/launch"
APIRlease = "https://gamecenter.fortureslot.com/api/v1/game/launch"
APITest = "https://gamecenter.pg2testing.com/api/v1/game/launch"
// LaunchGameURL = "/api/usr/ingame"
// GetGameListURL = "/api/game/loadlist"

@ -35,6 +35,7 @@ type RechargeInfoResp struct {
type PayInfo struct {
Amount int64 `json:"amount"`
Bonus int64 `json:"bonus"`
ProductId int `json:"productId"`
}
type RechargeInfoFirstResp struct {
@ -183,18 +184,22 @@ type WithDrawInfoResp struct {
Cash int64 // 货币
CanWithdraw int64 // 可提现金额
NeedBet int64 // 打码信息
WithdrawInfo WithdrawInfo
WithdrawalLimit int64
WithdrawInfo *WithdrawInfo
}
// WithdrawHistoryReq 请求退出记录
type WithdrawHistoryReq struct {
Page int `json:"page"` // 页码
PageSize int `json:"pageSize" binding:"required"` // 一页的数目
StartAt int64 `json:"startAt"`
EndAt int64 `json:"endAt"`
}
// WithdrawHistoryResp 请求退出记录返回
type WithdrawHistoryResp struct {
Count int64 `json:"Count"`
TotalAmount int64 `json:"TotalAmount"`
List []common.WithdrawOrder `json:"List"`
}

@ -39,6 +39,8 @@ type OneUserInfoVip struct {
WithdrawFee int64
WithdrawCount int
WithdrawAmount int
Exp int64
Level int
}
// Recharge 充值总额
@ -75,6 +77,7 @@ type BalanceHisReq struct {
PageSize int `json:"pageSize" binding:"required"` // 一页的数目
Start *int64 `json:"startAt"` // 开始时间戳
End *int64 `json:"endAt"` // 结束时间戳
Type int `json:"type"` // (0:全部,1:加,2:减)
}
// BalanceHisResp 金币流水记录返回

Loading…
Cancel
Save