补充逻辑

dev_aagame_provider
zhora 2 months ago
parent 41ab2ba1b9
commit 69cc2e5d2b
  1. 8
      call/config.go
  2. 2
      call/provider.go
  3. 10
      call/user.go
  4. 102
      common/currency.go
  5. 8
      modules/backend/handler/gm/control.go
  6. 10
      modules/web/handler/balance.go
  7. 32
      modules/web/handler/recharge.go
  8. 7
      modules/web/handler/user.go
  9. 10
      modules/web/handler/vip.go
  10. 27
      modules/web/handler/withdraw.go
  11. 2
      modules/web/providers/base/base.go
  12. 4
      modules/web/values/pay.go

@ -2018,6 +2018,14 @@ func GetConfigGameListByCode(provider int, gameCode string) *common.ConfigGameLi
return nil
}
func GetGameName(providerID int, gameCode string) string {
game := GetConfigGameListByCode(providerID, gameCode)
if game != nil {
return game.Name
}
return "Play Game"
}
func GetGameListByByID(providerID int, gameID int) (result *common.ConfigGameList) {
for _, v := range configGameListAll {
if v.GameProvider != providerID && v.GameID != gameID {

@ -86,7 +86,7 @@ func GetConfigProviderGameListByID(provider, gameID int) *common.ConfigProviderG
}
func GetProviderGameRtp(uid int) int {
return 1
return 90
}
func GetProviderUserName(name string) string {

@ -93,13 +93,9 @@ func AddUserXInfo(uid int, field string, value int64, tx ...*gorm.DB) error {
func initPlayer(uid, channel int) {
db.Mysql().Create(&common.PlayerData{UID: uid})
initCoin := GetConfigPlatform().NewPlayerGift
if initCoin < 0 {
initCoin = 0
}
db.Mysql().Create(&common.PlayerCurrency{UID: uid, ChannelID: channel, INR: initCoin})
db.Mysql().Create(&common.PlayerCurrency{UID: uid, ChannelID: channel, INR: 0})
// db.Mysql().C().Table(common.PlayerRechargeTableName).Create(&common.PlayerCurrency{UID: uid, ChannelID: channel})
db.Mysql().Create(&common.PlayerProfile{UID: uid, ChannelID: channel, NeedBet: GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, initCoin)})
db.Mysql().Create(&common.PlayerProfile{UID: uid, ChannelID: channel, NeedBet: 0})
}
func NewUser(info *common.PlayerDBInfo, ip, share, fbc, fbp, agent string) error {
@ -173,7 +169,7 @@ func NewUser(info *common.PlayerDBInfo, ip, share, fbc, fbp, agent string) error
UploadAdjust(common.AdjustEventNewPlayer, info, nil)
ShareBind(share, isOld, uid, cid)
// 新手赠送
first := config.GetConfig().Web.FreeSpinFirst
first := GetConfigPlatform().NewPlayerGift
if first > 0 {
UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{

@ -119,6 +119,94 @@ const (
CurrencyEventGMRecharge = 1001 // 后台模拟充值
)
func GetCurrencyName(currencyEvent CurrencyEvent) string {
switch currencyEvent {
case CurrencyEventNewPlayer:
return "New Register Gift"
case CurrencyEventGameSettle:
return "Game Settlement"
case CurrencyEventGameBet:
return "Game Bet"
case CurrencyEventGameCancelBet:
return "Cancel Bet"
case CurrencyEventReCharge:
return "Recharge"
case CurrencyEventWithDraw:
return "Withdraw"
case CurrencyEventWithDrawBack:
return "Exit Fail Refund"
case CurrencyEventMailDraw:
return "Mail Reward"
case CurrencyEventGameVoidSettle:
return "Game Cancel Settlement"
case CurrencyEventGameActivity:
return "Game Event Gift"
case CurrencyEventGameReSettle:
return "Game Adjust Settlement"
case CurrencyEventGameAdjustment:
return "Game Adjust Balance"
case CurrencyEventBindPhone:
return "Bind Phone Reward"
case CurrencyEventVIPBonus:
return "VIP Level Reward"
case CurrencyEventVIPCashback:
return "VIP Rebate"
case CurrencyEventActivityAppSpin:
return "Download App Lucky Draw"
case CurrencyEventShareWithdraw:
return "Share Reward"
case CurrencyEventActivityPdd:
return "PDD Share Reward"
case CurrencyEventGameAdjustBet:
return "Bet Adjustment"
case CurrencyEventGameBonus:
return "Game Bonus"
case CurrencyEventGameJackpot:
return "Game Jackpot"
case CurrencyEventGameBuyIn:
return "Game Deduction"
case CurrencyEventGameBuyOut:
return "Game Addition"
case CurrencyEventTask:
return "Task Reward'"
case CurrencyEventActivityFreeSpin:
return "Free Spin"
case CurrencyEventActivityFirstRechargeBack:
return "First Day Recharge Refund"
case CurrencyEventActivityLuckyCode:
return "Redemption Code Event"
case CurrencyEventActivitySign:
return "Check-in Event"
case CurrencyEventActivityBreakGift:
return "Bankruptcy Package Event"
case CurrencyEventActivityWeekCard:
return "Weekly Card"
case CurrencyEventActivitySlots:
return "Slots Jackpot"
case CurrencyEventActivitySuper:
return "Super 1+2"
case CurrencyEventActivityShareBind:
return "Share Invite Award"
case CurrencyEventActivityShareRank:
return "Share Rank Award"
case CurrencyEventDrawMail:
return "Mail Award"
case CurrencyEventLuckyWheel:
return "Lucky Wheel Award"
case CurrencyEventVIPWeekBonus:
return "Vip Week Award"
case CurrencyEventShare:
return "Share Award"
case CurrencyEventShareBeInvite:
return "Share Inviter Award"
case CurrencyEventRankAward:
return "Bet Rank Award"
case CurrencyEventShareRankAward:
return "Share Rank Award"
}
return ""
}
func GetCurrencyTypeName(ct CurrencyEvent) string {
switch ct {
case CurrencyEventNewPlayer:
@ -223,6 +311,17 @@ func RoundCurrency(t CurrencyType, amount int64) int64 {
}
}
func RoundCurrencyWithdraw(t CurrencyType, amount int64) int64 {
switch t {
case CurrencyINR:
return amount * DecimalDigits
case CurrencyUSDT:
return amount / 100 * 100
default:
return amount
}
}
type UpdateCurrency struct {
NotNotify bool // 为true时不通知客户端
Tx *gorm.DB
@ -255,6 +354,9 @@ type CurrencyBalance struct {
Exs1 string `gorm:"column:exs1;type:varchar(64);comment:额外string字段1" json:"exs1"`
Exs2 string `gorm:"column:exs2;type:varchar(64);comment:额外string字段2" json:"exs2"`
Exs3 string `gorm:"column:exs3;type:varchar(64);comment:额外string字段3" json:"exs3"`
Exs4 string `gorm:"column:exs4;type:varchar(64);comment:额外string字段4" json:"exs4"`
EventName string `gorm:"-" json:"event_name"`
}
func (c *CurrencyBalance) TableName() string {

@ -121,14 +121,6 @@ func CheckEditSpecial(t int, obj interface{}, config []map[string]interface{}, a
}
switch t {
case common.ReloadConfigGameList:
for _, update := range config {
delete(update, "GameProvider")
delete(update, "GameID")
delete(update, "GameCode")
delete(update, "Icon")
delete(update, "Name")
delete(update, "GameType")
}
case common.ReloadConfigRank:
// todo 校验活动是否存在
for _, update := range config {

@ -64,5 +64,15 @@ func BalanceHistory(c *gin.Context) {
// q.Must(elastic.NewMatchQuery("uid", a.UID))
resp.Count, _ = db.ES().QueryList(common.ESIndexBalance, req.Page, req.PageSize, q, &resp.List, "id", false)
for index, v := range resp.List {
var eventName string
if v.Exs4 != "" {
eventName = v.Exs4
}
if eventName == "" {
eventName = common.GetCurrencyName(v.Event)
}
resp.List[index].EventName = eventName
}
a.Data = resp
}

@ -170,21 +170,33 @@ func RechargeHistory(c *gin.Context) {
if !a.S(req) {
return
}
ret := []common.RechargeOrder{}
var count int64
resp := &values.RechargeHistoryResp{}
a.Data = resp
now := time.Now()
switch req.Tag {
case 0:
req.StartAt = now.AddDate(0, 0, -1).Unix()
req.EndAt = now.Unix()
case 1:
req.StartAt = now.AddDate(0, 0, -7).Unix()
req.EndAt = now.Unix()
case 2:
req.StartAt = now.AddDate(0, 0, -30).Unix()
req.EndAt = now.Unix()
}
var err error
count, err = db.Mysql().QueryListW(req.Page, req.PageSize, "create_time desc",
&common.RechargeOrder{UID: a.UID}, &ret, "uid = ? and event = ?",
a.UID, common.CurrencyEventReCharge)
mdb := db.Mysql().C().Model(&common.RechargeOrder{}).Where("uid = ? and event = ? and create_time >= ? and create_time <= ? ",
a.UID, common.CurrencyEventReCharge, req.StartAt, req.EndAt)
err = mdb.Count(&resp.Count).Error
if err != nil {
log.Error("err:%v", err)
log.Error("get recharge order count err, %s", err.Error())
}
err = mdb.Order("create_time desc").Offset(req.Page * req.PageSize).Limit(req.PageSize).Find(&resp.List).Error
if err != nil {
log.Error("get recharge order list err, %s", err.Error())
a.Code = values.CodeRetry
return
}
resp := values.RechargeHistoryResp{
Count: count,
List: ret,
}
for index, v := range resp.List {
switch v.Status {
case 1, 2:

@ -6,7 +6,6 @@ import (
"reflect"
"server/call"
"server/common"
"server/config"
"server/db"
"server/modules/web/app"
"server/modules/web/values"
@ -80,10 +79,8 @@ func getUserInfo(uid int, isNew bool) (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
if resp.Currencys[common.CurrencyINR] == 0 {
resp.Currencys[common.CurrencyINR] = call.GetConfigPlatform().NewPlayerGift
}
}
re := &common.RechargeInfo{UID: uid}

@ -316,6 +316,16 @@ func VipBalanceHistory(c *gin.Context) {
}
resp.Count, _ = db.ES().QueryList(common.ESIndexBalance, req.Page, req.PageSize, q, &resp.List, "id", false)
resp.TotalAmount = db.ES().SumByInt64(common.ESIndexBalance, "value", q)
for index, v := range resp.List {
var eventName string
if v.Exs4 != "" {
eventName = v.Exs4
}
if eventName == "" {
eventName = common.GetCurrencyName(v.Event)
}
resp.List[index].EventName = eventName
}
a.Data = resp
}

@ -245,6 +245,18 @@ func WithdrawHistory(c *gin.Context) {
if req.PageSize > 100 {
req.PageSize = 100
}
now := time.Now()
switch req.Tag {
case 0:
req.StartAt = now.AddDate(0, 0, -1).Unix()
req.EndAt = now.Unix()
case 1:
req.StartAt = now.AddDate(0, 0, -7).Unix()
req.EndAt = now.Unix()
case 2:
req.StartAt = now.AddDate(0, 0, -30).Unix()
req.EndAt = now.Unix()
}
resp := &values.WithdrawHistoryResp{}
a.Data = resp
@ -252,12 +264,8 @@ func WithdrawHistory(c *gin.Context) {
ret := []common.WithdrawOrder{}
var count, totalAmount int64
var err error
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)
}
mdb := db.Mysql().C().Model(&common.WithdrawOrder{}).Where("uid = ? and event = ? and create_time >= ? and create_time <= ?",
a.UID, common.CurrencyEventWithDraw, req.StartAt, req.EndAt)
err = mdb.Count(&count).Error
if err != nil {
log.Error("get count err, %s", err.Error())
@ -266,6 +274,8 @@ func WithdrawHistory(c *gin.Context) {
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())
a.Code = values.CodeRetry
return
}
err = mdb.Select("COALESCE(SUM(amount), 0)").Scan(&totalAmount).Error
@ -273,9 +283,8 @@ func WithdrawHistory(c *gin.Context) {
log.Error("get total withdraw amount err, %s", err.Error())
}
resp.TotalAmount = totalAmount * common.DecimalDigits
resp.TotalAmount = totalAmount
for i, v := range ret {
ret[i].Amount *= common.DecimalDigits
var status uint8
if v.Status == common.StatusROrderCreate || v.Status == common.StatusROrderWaitting {
status = 0
@ -439,7 +448,7 @@ func PlayerWithdraw(c *gin.Context) {
}
uid := a.UID
log.Debug("player %v withdraw %+v", uid, *req)
req.Amount = common.RoundCurrency(req.CurrencyType, req.Amount)
req.Amount = common.RoundCurrencyWithdraw(req.CurrencyType, req.Amount)
// 退出条件限制
if !a.CheckWithdrawCondition(req.Amount, req.CurrencyType) {

@ -382,6 +382,7 @@ func SessionBet(req *BetReq) (resp BetResp) {
Exs1: fmt.Sprintf("%d", uuid),
Exs2: req.BetID,
Exs3: req.SessionID,
Exs4: call.GetGameName(req.Provider.ProviderID, req.GameName) + " Bet",
},
},
)
@ -423,6 +424,7 @@ func SessionBet(req *BetReq) (resp BetResp) {
Exs1: fmt.Sprintf("%d", uuid),
Exs2: req.BetID,
Exs3: req.SessionID,
Exs4: call.GetGameName(req.Provider.ProviderID, req.GameName) + " Settle",
}
pro = call.MineCurrencyProReal(
&common.UpdateCurrency{

@ -78,6 +78,9 @@ type RechargeHistoryReq struct {
PageSize int `json:"pageSize"` // 一页的数目
// Start *string `json:"Start"` // 开始时间
// End *string `json:"End"` // 结束时间
StartAt int64 `json:"startAt"`
EndAt int64 `json:"endAt"`
Tag int `json:"tag"`
}
// RechargeHistoryResp 请求充值记录返回
@ -194,6 +197,7 @@ type WithdrawHistoryReq struct {
PageSize int `json:"pageSize" binding:"required"` // 一页的数目
StartAt int64 `json:"startAt"`
EndAt int64 `json:"endAt"`
Tag int `json:"tag"`
}
// WithdrawHistoryResp 请求退出记录返回

Loading…
Cancel
Save