补充逻辑

dev_aagame_provider
zhora 2 months ago
parent 43c4859900
commit b0650c9915
  1. 3
      call/currency.go
  2. 13
      common/activity.go
  3. 17
      modules/backend/handler/sys/sys.go
  4. 5
      modules/backend/values/protocol.go
  5. 54
      modules/pay/values/values.go
  6. 2
      modules/web/app/response.go
  7. 49
      modules/web/handler/pdd.go
  8. 17
      modules/web/handler/withdraw.go
  9. 2
      modules/web/middleware/cross.go
  10. 28
      modules/web/providers/base/base.go
  11. 1
      modules/web/routers/routers_pdd.go
  12. 9
      modules/web/values/pay.go
  13. 10
      modules/web/values/pdd.go

@ -206,7 +206,8 @@ func (b *BaseCurrency) UpdatePro() (*ProRes, error) {
if b.ProType == ProTypeMineCash { if b.ProType == ProTypeMineCash {
callName = "mineCurrency" callName = "mineCurrency"
} }
err := db.Mysql().C().Raw(fmt.Sprintf("call %s(%d,'%v',%d,%d,@a,@b)", callName, uid, field, b.Value, b.NeedBet)).Scan(pro).Error sql := fmt.Sprintf("call %s(%d,'%v',%d,%d,@a,@b)", callName, uid, field, b.Value, b.NeedBet)
err := db.Mysql().C().Raw(sql).Scan(pro).Error
if err != nil { if err != nil {
log.Error("err:%v", err) log.Error("err:%v", err)
return pro, err return pro, err

@ -663,12 +663,13 @@ func (m *PddDataNew) TableName() string {
} }
type PddLotteryHistory struct { type PddLotteryHistory struct {
ID int `gorm:"primarykey"` ID int `gorm:"primarykey"`
UID int `gorm:"column:uid;not null;type:int(11)" json:"uid"` UID int `gorm:"column:uid;not null;type:int(11)" json:"uid"`
ExpiredAt int64 `gorm:"column:expired_at;type:bigint(20);comment:过期时间" json:"expiredAt"` WithdrawRecord int `gorm:"column:withdraw_record;default:0;type:int(11);comment:是否是提现记录" json:"withdrawRecord"`
AddAmount string `gorm:"column:add_amount;type:varchar(255);default:'';comment:增加余额" json:"addAmount"` ExpiredAt int64 `gorm:"column:expired_at;type:bigint(20);comment:过期时间" json:"expiredAt"`
Amount string `gorm:"column:amount;type:varchar(255);default:'';comment:余额" json:"amount"` AddAmount string `gorm:"column:add_amount;type:varchar(255);default:'';comment:增加余额" json:"addAmount"`
CreatedAt int64 `gorm:"column:created_at;type:bigint(20);comment:创建时间" json:"createdAt"` Amount string `gorm:"column:amount;type:varchar(255);default:'';comment:余额" json:"amount"`
CreatedAt int64 `gorm:"column:created_at;type:bigint(20);comment:创建时间" json:"createdAt"`
} }
func (m *PddLotteryHistory) TableName() string { func (m *PddLotteryHistory) TableName() string {

@ -339,6 +339,23 @@ func EditChannel(c *gin.Context) {
// one.FBAccessToken = *req.FBAccessToken // one.FBAccessToken = *req.FBAccessToken
update["ad_upload"] = *req.ADUpload update["ad_upload"] = *req.ADUpload
} }
if req.ShareUrl != nil && one.ShareURL != *req.ShareUrl {
update["share_url"] = *req.ShareUrl
}
if req.UIVersion != nil && one.UIVersion != *req.UIVersion {
update["ui_version"] = *req.UIVersion
}
if req.ApiURL != nil && one.ApiURL != *req.ApiURL {
update["api_url"] = *req.ApiURL
}
if req.HotURL != nil && one.HotURL != *req.HotURL {
update["hot_url"] = *req.HotURL
}
if req.Is != nil && one.Is != *req.Is {
update["is"] = *req.Is
}
if len(update) == 0 { if len(update) == 0 {
a.Code = values.CodeParam a.Code = values.CodeParam
a.Msg = "无内容修改" a.Msg = "无内容修改"

@ -247,6 +247,11 @@ type EditChannelReq struct {
FBAccessToken *string FBAccessToken *string
UP *int UP *int
ADUpload *int ADUpload *int
ShareUrl *string `json:"ShareUrl"`
UIVersion *string `json:"UIVersion"`
ApiURL *string `json:"ApiURL"`
HotURL *string `json:"HotURL"`
Is *int `json:"Is"`
} }
// DelChannelReq 删除渠道 // DelChannelReq 删除渠道

@ -100,9 +100,63 @@ const (
MtxxPay MtxxPay
RobusPay RobusPay
MoneydealerNativePay MoneydealerNativePay
VirgoPay
PayAll PayAll
) )
type WithdrawWay int
const (
FunzoneWithdraw WithdrawWay = iota
WellWithdraw
OctroWithdraw
IGeekWithdraw
CloudWithdraw
VSWithdraw
JoyWithdraw
FFWithdraw
BestWithdraw
HXWithdraw
MGWithdraw
OOWithdraw
ZWWithdraw
FastWithdraw
HaoWithdraw
QPWithdraw
OwlWithdraw
SkyWithdraw
GreWithdraw
MoonWithdraw
AceWithdraw
MccWithdraw
YoduWithdraw
WordWithdraw
HWWithdraw
JJWithdraw
AntWithdraw
MLWithdraw
RojWithdraw
QuantaWithdraw
InnoWithdraw
PeWithdraw
FF8Withdraw
FlaWithdraw
DidaWithdraw
CYGGWithdraw
ZWithdraw
HappyWithdraw
FastPlusWithdraw
GoWithdraw
LemonWithdraw
CamelWithdraw
MoonWithdraw2
SWithdraw
VendooWithdraw
MtxxPayWithdraw
RobusWithdraw
WithdrawAll
)
// 错误码 // 错误码
const ( const (
CodeOk = iota CodeOk = iota

@ -36,6 +36,7 @@ type Gin struct {
WhiteIps []string WhiteIps []string
Prefix string Prefix string
DeviceType int DeviceType int
Resversion int
} }
type R struct { type R struct {
@ -53,6 +54,7 @@ func NewApp(c *gin.Context) *Gin {
g.Token = c.GetHeader("token") g.Token = c.GetHeader("token")
g.Lang = common.CheckLang(c.GetHeader("lang")) g.Lang = common.CheckLang(c.GetHeader("lang"))
g.Referrer = c.GetHeader("referrer") g.Referrer = c.GetHeader("referrer")
g.Resversion = util.ToInt(c.GetHeader("resversion"))
channel := c.GetHeader("channel") channel := c.GetHeader("channel")
if len(channel) > 0 { if len(channel) > 0 {
g.Channel, _ = strconv.Atoi(channel) g.Channel, _ = strconv.Atoi(channel)

@ -96,7 +96,7 @@ func PddCfg(c *gin.Context) {
} }
} }
historyDB := db.Mysql().C().Model(&common.PddLotteryHistory{}). historyDB := db.Mysql().C().Model(&common.PddLotteryHistory{}).
Where("uid = ? and expired_at = ?", uid, pddData.ExpiredAt). Where("uid = ? and expired_at = ? and withdraw_record = 0", uid, pddData.ExpiredAt).
Order("created_at desc") Order("created_at desc")
if req.Page != 0 && req.PageSize != 0 { if req.Page != 0 && req.PageSize != 0 {
historyDB = historyDB.Offset((req.Page - 1) * req.PageSize).Limit(req.PageSize) historyDB = historyDB.Offset((req.Page - 1) * req.PageSize).Limit(req.PageSize)
@ -116,7 +116,6 @@ func PddCfg(c *gin.Context) {
}, },
} }
} }
log.Debug("resp:%+v", *resp)
} }
func PddLottery(c *gin.Context) { func PddLottery(c *gin.Context) {
@ -281,6 +280,17 @@ func PddDraw(c *gin.Context) {
a.Code = values.CodeRetry a.Code = values.CodeRetry
return return
} }
err = db.Mysql().C().Model(&common.PddLotteryHistory{}).Create(&common.PddLotteryHistory{
UID: uid,
WithdrawRecord: 1,
ExpiredAt: pddData.ExpiredAt,
AddAmount: fmt.Sprintf("%d", pdd.WithdrawalAmount),
Amount: fmt.Sprintf("%d", pdd.WithdrawalAmount),
CreatedAt: time.Now().Unix(),
}).Error
if err != nil {
log.Error("create award history err, %s", err.Error())
}
_, err = call.UpdateCurrencyPro(&common.UpdateCurrency{ _, err = call.UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{ CurrencyBalance: &common.CurrencyBalance{
UID: a.UID, UID: a.UID,
@ -298,3 +308,38 @@ func PddDraw(c *gin.Context) {
} }
resp.Amount = pdd.WithdrawalAmount resp.Amount = pdd.WithdrawalAmount
} }
func PddAwardHistory(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.PddDrawHistoryReq)
if !a.S(req) {
return
}
uid := a.UID
resp := &values.PddDrawHistoryResp{}
a.Data = resp
mdb := db.Mysql().C().Model(&common.PddLotteryHistory{}).
Where("uid = ? and withdraw_record = 1", uid)
err := mdb.Count(&resp.Total).Error
if err != nil {
log.Error("get ward history count err, %s", err.Error)
a.Code = values.CodeRetry
return
}
mdb = mdb.Order("created_at desc")
if req.Page != 0 && req.PageSize != 0 {
mdb = mdb.Offset((req.Page - 1) * req.PageSize).Limit(req.PageSize)
}
err = mdb.Find(&resp.LotteryHistory).Error
if err != nil {
log.Error("get award history err, %s", err.Error())
a.Code = values.CodeRetry
return
}
}

@ -206,6 +206,23 @@ func WithdrawInfo(c *gin.Context) {
if resp.NeedBet == 0 { if resp.NeedBet == 0 {
resp.CanWithdraw = resp.Cash resp.CanWithdraw = resp.Cash
} }
var withdrawInfo common.WithdrawInfo
err := db.Mysql().C().Model(&common.WithdrawInfo{}).Where("uid = ?", a.UID).Find(&withdrawInfo).Error
if err != nil {
log.Error("err:%v", err)
a.Code = values.CodeRetry
return
}
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 a.Data = resp
} }

@ -25,7 +25,7 @@ func CrosHandler() gin.HandlerFunc {
context.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE,UPDATE") context.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE,UPDATE")
//允许跨域设置可以返回其他子段,可以自定义字段 //允许跨域设置可以返回其他子段,可以自定义字段
context.Header("Access-Control-Allow-Headers", "fbc,fbp,lang,zone,res_version,share,Channel,uuid,version,Authorization, Content-Length, X-CSRF-Token, Token,session,X_Requested_With,Accept, Origin, Host, Connection, Accept-Encoding, Accept-Language,DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Pragma,token,openid,opentoken") context.Header("Access-Control-Allow-Headers", "fbc,fbp,lang,zone,res_version,share,Channel,uuid,version,Resversion,Authorization, Content-Length, X-CSRF-Token, Token,session,X_Requested_With,Accept, Origin, Host, Connection, Accept-Encoding, Accept-Language,DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Pragma,token,openid,opentoken")
// 允许浏览器(客户端)可以解析的头部 (重要) // 允许浏览器(客户端)可以解析的头部 (重要)
context.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers,Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,FooBar") context.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers,Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,FooBar")

@ -368,8 +368,9 @@ func SessionBet(req *BetReq) (resp BetResp) {
resp.MyUUID = uuid resp.MyUUID = uuid
return return
} }
if betAmount > 0 { var pro *call.ProRes
pro := call.MineCurrencyProReal( if betAmount > 0 { // 存储下注金额
pro = call.MineCurrencyProReal(
&common.UpdateCurrency{ &common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{ CurrencyBalance: &common.CurrencyBalance{
UID: uid, UID: uid,
@ -391,13 +392,25 @@ func SessionBet(req *BetReq) (resp BetResp) {
resp.Code = CodeNotEnoughAmount resp.Code = CodeNotEnoughAmount
} }
} }
if req.SessionType == SessionTypeBet { if req.SessionType == SessionTypeBet { // 下注回合的直接返回,等结算的再一起上报
resp.Balance = pro.Balance resp.Balance = pro.Balance
resp.MyUUID = uuid resp.MyUUID = uuid
return return
} }
} }
var pro *call.ProRes if pro == nil {
tmpRecord := &common.ProviderBetRecord{
UID: uid,
SessionID: req.SessionID,
Type: 1,
}
db.Mysql().Get(tmpRecord)
if tmpRecord.ID == 0 {
resp.Code = CodeBetNotExist
return
}
betAmount = tmpRecord.Amount
}
setValue := settle + req.Preserve setValue := settle + req.Preserve
if setValue != 0 { if setValue != 0 {
cb := &common.CurrencyBalance{ cb := &common.CurrencyBalance{
@ -423,17 +436,18 @@ func SessionBet(req *BetReq) (resp BetResp) {
} }
} }
util.IndexTryS(func() error { util.IndexTryS(func() error {
return call.Publish(natsClient.TopicInnerAfterSettle, &pb.InnerAfterSettle{ sendData := &pb.InnerAfterSettle{
UID: int64(uid), UID: int64(uid),
ProviderID: int64(provider.ProviderID), ProviderID: int64(provider.ProviderID),
GameID: int64(req.GameID), GameID: int64(req.GameID),
UUID: req.BetID, UUID: req.BetID,
CurrencyType: int64(ct), CurrencyType: int64(ct),
TotalBet: req.TurnOver, TotalBet: betAmount,
OriginSettle: settle, OriginSettle: settle,
FinalSettle: settle, FinalSettle: settle,
MyUUID: fmt.Sprintf("%d", uuid), MyUUID: fmt.Sprintf("%d", uuid),
}) }
return call.Publish(natsClient.TopicInnerAfterSettle, sendData)
}) })
if pro != nil { if pro != nil {
resp.Balance = pro.Balance resp.Balance = pro.Balance

@ -9,4 +9,5 @@ func pdd(e *gin.RouterGroup) {
e.POST("/pdd/cfg", handler.PddCfg) e.POST("/pdd/cfg", handler.PddCfg)
e.POST("/pdd/lottery", handler.PddLottery) e.POST("/pdd/lottery", handler.PddLottery)
e.POST("/pdd/award", handler.PddDraw) e.POST("/pdd/award", handler.PddDraw)
e.POST("/pdd/award/history", handler.PddAwardHistory)
} }

@ -117,7 +117,7 @@ type WithdrawCheckReq struct {
// WithdrawReq 退出请求 // WithdrawReq 退出请求
type WithdrawReq struct { type WithdrawReq struct {
Type int `json:"Type" binding:"required"` Type int `json:"Type"`
ChannelID *int `json:"ChannelID"` // 代付渠道选择 ChannelID *int `json:"ChannelID"` // 代付渠道选择
CurrencyType common.CurrencyType `json:"CurrencyType"` CurrencyType common.CurrencyType `json:"CurrencyType"`
// 可能对应多种结构 // 可能对应多种结构
@ -180,9 +180,10 @@ type WithDrawInfoResp struct {
Fees []int64 Fees []int64
Bets []int64 Bets []int64
Cash int64 // 货币 Cash int64 // 货币
CanWithdraw int64 // 可提现金额 CanWithdraw int64 // 可提现金额
NeedBet int64 // 打码信息 NeedBet int64 // 打码信息
WithdrawInfo WithdrawInfo
} }
// WithdrawHistoryReq 请求退出记录 // WithdrawHistoryReq 请求退出记录

@ -44,3 +44,13 @@ type PddDrawReq struct {
type PddDrawResp struct { type PddDrawResp struct {
Amount int `json:"amount"` // 金额 Amount int `json:"amount"` // 金额
} }
type PddDrawHistoryReq struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type PddDrawHistoryResp struct {
Total int64 `json:"total"`
LotteryHistory []common.PddLotteryHistory `json:"lotteryHistory"`
}

Loading…
Cancel
Save