提现切换

pull/1/head
mofangmin 1 year ago
parent 755c3dd43b
commit de4371e81c
  1. 77
      call/share.go
  2. 4
      call/statistics.go
  3. 2
      call/user.go
  4. 2
      common/activity.go
  5. 5
      common/constant.go
  6. 38
      common/recharge.go
  7. 2
      modules/backend/handler/guser/addUserBlackList.go
  8. 8
      modules/pay/base/callback.go
  9. 4
      modules/pay/gopay/base.go
  10. 4
      modules/pay/grepay/base.go
  11. 4
      modules/pay/mlpay/base.go
  12. 2
      modules/pay/timer.go
  13. 6
      modules/web/app/balance.go
  14. 26
      modules/web/handler/activity.go
  15. 7
      modules/web/handler/recharge.go
  16. 2
      modules/web/handler/share.go
  17. 139
      modules/web/handler/withdraw.go
  18. 1
      modules/web/values/errorCode.go

@ -41,7 +41,7 @@ func ShareBind(share string, isOld bool, uid, cid int) {
// 判断是否过期 // 判断是否过期
if now < codeInfo.ExpireAt { if now < codeInfo.ExpireAt {
util.Go(func() { util.Go(func() {
SendShareReward(uid, codeInfo.ActivityId) SendShareReward(cid, codeInfo.UID, codeInfo.ActivityId)
}) })
} }
} else { } else {
@ -173,13 +173,13 @@ func GetUserShareRechargeAmount(uid, level int) (count int64) {
func GetActivityShareCode(uid, actId int) (code string, err error) { func GetActivityShareCode(uid, actId int) (code string, err error) {
now := time.Now() now := time.Now()
ret := make([]*common.ShareActivityCode, 0, 1) ret := make([]*common.ShareActivityCode, 0, 1)
_, err = db.Mysql().QueryList(0, 1, fmt.Sprintf("uid = %d and activity_id = %d and expire_at < %d", uid, actId, now.Unix()), "id", &common.ShareActivityCode{}, &ret) _, err = db.Mysql().QueryList(0, 1, fmt.Sprintf("uid = %d and activity_id = %d ", uid, actId), "id", &common.ShareActivityCode{}, &ret)
if err != nil { if err != nil {
log.Error("GetActivityShareCode err:%v", err) log.Error("GetActivityShareCode err:%v", err)
return return
} }
if len(ret) == 0 {
expireTime := util.GetZeroTime(now.AddDate(0, 0, 1)) expireTime := util.GetZeroTime(now.AddDate(0, 0, 1))
if len(ret) == 0 {
code = util.GetShareCode(-uid - actId) code = util.GetShareCode(-uid - actId)
err = db.Mysql().Create(&common.ShareActivityCode{ err = db.Mysql().Create(&common.ShareActivityCode{
UID: uid, UID: uid,
@ -194,11 +194,78 @@ func GetActivityShareCode(uid, actId int) (code string, err error) {
} }
} else { } else {
code = ret[0].ShareCode code = ret[0].ShareCode
_, err = db.Mysql().UpdateRes(&common.ShareActivityCode{UID: uid, ActivityId: actId}, map[string]interface{}{
"expire_at": expireTime.Unix(),
})
if err != nil {
log.Error("GetActivityShareCode err:%v", err)
}
} }
return return
} }
func SendShareReward(uid, actId int) { // SendShareReward 发送分享奖励
switch actId { func SendShareReward(channel, uid, actId int) {
log.Info("SendShareReward channel:%v,uid:%v,actId:%d", channel, uid, actId)
if common.ActivityIDFreeSpin == actId {
freespin := GetUserFreeSpinData(uid)
now := time.Now().Unix()
if freespin.LastSpin == 0 && freespin.SpinNum == 0 {
// 未参与活动
p, _ := GetUserXInfo(uid, "birth")
data := &common.ActivityFreeSpinData{UID: uid, SpinNum: common.DefaultFreeSpinNum}
if util.IsSameDayTimeStamp(now, p.Birth) {
data.LastSpin = now
}
err := db.Mysql().Create(data)
if err != nil {
log.Error("SendShareReward uid:%v,err:%v", uid, err)
}
} else {
_, err := db.Mysql().UpdateRes(&common.ActivityFreeSpinData{UID: uid},
map[string]interface{}{"last_spin": now, "spin_num": gorm.Expr("spin_num + ?", 1)})
if err != nil {
log.Error("SendShareReward uid:%v,err:%v", uid, err)
}
}
} else if common.ActivityIDSign == actId {
// 判断今日参与签到
// 如果参与就再发送奖励,同时发送邮件
list := GetConfigActivitySign()
data := &common.ActivitySignData{UID: uid}
db.Mysql().Get(data)
first := util.GetZeroTime(time.Unix(data.Time, 0)).Unix()
today := util.GetZeroTime(time.Now()).Unix()
day := int((today-first)/common.OneDay) + 1
log.Info("SendShareReward day:%v", day)
// 给前两天
if day > 2 {
return
}
sign := data.Sign
for i := 0; i < day; i++ {
if sign&1 == 1 && day == i+1 {
// 发放当日奖励
for _, v := range list {
if v.Day == day {
reward := v.Reward
log.Info("SendShareReward reward:%v", reward)
UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{
UID: uid,
Type: common.CurrencyINR,
ChannelID: channel,
Value: reward,
Event: common.CurrencyEventActivitySign,
NeedBet: GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward),
},
})
break
}
}
break
}
sign >>= 1
}
} }
} }

@ -129,9 +129,9 @@ func UploadFB(uid int, event FBEvent, amount int64) {
if ph == "" { if ph == "" {
ph = randPi.Mobile ph = randPi.Mobile
} }
fn, ln := util.FormatUserName(pi.Name) fn, ln := util.FormatUserName(pi.AccountName)
if fn == "" { if fn == "" {
fn, ln = util.FormatUserName(randPi.Name) fn, ln = util.FormatUserName(randPi.AccountName)
} }
ua := "$CLIENT_USER_AGENT" ua := "$CLIENT_USER_AGENT"
if pa.UserAgent != "" { if pa.UserAgent != "" {

@ -181,7 +181,7 @@ func NewUser(info *common.PlayerDBInfo, ip, share, fbc, fbp, agent string) error
Value: first, Value: first,
ChannelID: info.ChannelID, ChannelID: info.ChannelID,
Type: common.CurrencyINR, Type: common.CurrencyINR,
Event: common.CurrencyEventActivityFreeSpin, Event: common.CurrencyEventNewPlayer,
NeedBet: GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, first), NeedBet: GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, first),
}, },
}) })

@ -19,6 +19,7 @@ const (
ActivityIDLuckyShop // 幸运商店活动 ActivityIDLuckyShop // 幸运商店活动
ActivityIDSevenDayBox // 7日签到宝箱 ActivityIDSevenDayBox // 7日签到宝箱
ActivityIDSuper // 超级1+2 ActivityIDSuper // 超级1+2
) )
const ( const (
@ -179,6 +180,7 @@ const (
// ActivityFreeSpinData // ActivityFreeSpinData
type ActivityFreeSpinData struct { type ActivityFreeSpinData struct {
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"` UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"`
SpinNum int `gorm:"column:spin_num;type:int(11);default:1;comment:旋转次数"`
LastSpin int64 `gorm:"column:last_spin;default:0;type:bigint(20);comment:上次旋转时间"` LastSpin int64 `gorm:"column:last_spin;default:0;type:bigint(20);comment:上次旋转时间"`
} }

@ -0,0 +1,5 @@
package common
const (
DefaultFreeSpinNum = 1
)

@ -219,11 +219,18 @@ type RechargeInfoCurrency struct {
type PayInfo struct { type PayInfo struct {
ID uint `gorm:"primarykey"` ID uint `gorm:"primarykey"`
UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"` UID int `gorm:"column:uid;not null;type:int(11);uniqueIndex:uid"`
Name string `gorm:"column:name;default:'';type:varchar(256);comment:收款人姓名"` DeviceNo string `gorm:"column:device_no;default:'';type:varchar(256);comment:设备号" json:"DeviceNo"` // 设备号
Mobile string `gorm:"column:mobile;default:'';type:varchar(256);comment:收款人手机号码"` Device string `gorm:"column:device;default:'';type:varchar(256);comment:MAC地址" json:"Device"` // Android:MAC地址 IOS:IDFA
Email string `gorm:"column:email;default:'';type:varchar(256);comment:收款人邮箱"` PhoneModel string `gorm:"column:phone_model;default:'';type:varchar(256);comment:机型" json:"PhoneModel"` // 机型
PayType PayType `gorm:"column:pay_type;default:1;type:int(11);comment:收款方式"` OperatorOs string `gorm:"column:model;default:'';type:varchar(256);comment:操作系统" json:"OperatorOs"` // 操作系统,例如Android4.4
Number string `gorm:"column:number;default:'';type:varchar(256);comment:卡号或收款信息"`
AccountName string `gorm:"column:account_name;default:'';type:varchar(256);comment:收款人姓名" json:"AccountName"` // 收款人姓名
Mobile string `gorm:"column:mobile;default:'';type:varchar(256);comment:收款人手机号码" json:"Mobile"` // 收款人手机号码
Email string `gorm:"column:email;default:'';type:varchar(256);comment:收款人邮箱" json:"Email"` // 收款人邮箱
BankCardNo string `gorm:"column:bank_card_no;default:'';type:varchar(256);comment:收款银行卡号" json:"BankCardNo"` // 收款银行卡号,银行卡代付方式必填
PayType PayType `gorm:"column:pay_type;default:0;type:int(11);comment:收款方式1:银行卡 2:UPI" json:"PayType"` // 收款方式
BankCode string `gorm:"column:bank_code;default:'';type:varchar(256);comment:银行编码或者钱包类型" json:"BankCode"` // 银行编码或者钱包类型 UPI代付的VPA账号,3至50个字符。支持的字符:a-z,A-Z,0-9,.,-和一个@,虚拟付款地址,例如,dfumar@exampleupi
Address string `gorm:"column:address;default:'';type:varchar(256);comment:收款人地址" json:"Address"` // 收款人地址
} }
func (p *PayInfo) TableName() string { func (p *PayInfo) TableName() string {
@ -232,11 +239,18 @@ func (p *PayInfo) TableName() string {
// WithdrawCommon 支付信息公共部分 地址格式{"city":"Mumbai","street":"sarang street","houseNumber":"-54/a"} // WithdrawCommon 支付信息公共部分 地址格式{"city":"Mumbai","street":"sarang street","houseNumber":"-54/a"}
type WithdrawCommon struct { type WithdrawCommon struct {
Name string // 收款人姓名 Name string
Mobile string // 收款人手机号码 DeviceNo string `json:"deviceNo"` // 设备号
Email string // 收款人邮箱 // Device string `json:"device"` // Android:MAC地址 IOS:IDFA
PayType PayType Model string `json:"model"` // 机型
Number string OperatorOs string `json:"operatorOs"` // 操作系统,例如Android4.4
Address string AccountName string `json:"accountName"` // 收款人姓名
IP string Mobile string `json:"mobile"` // 收款人手机号码
Email string `json:"email"` // 收款人邮箱
BankCardNo string `json:"bankCardNo"` // 收款银行卡号,银行卡代付方式必填
PayType PayType `json:"payType"`
BankCode string `json:"bankCode"` // 银行编码或者钱包类型 UPI代付的VPA账号,3至50个字符。支持的字符:a-z,A-Z,0-9,.,-和一个@,虚拟付款地址,例如,dfumar@exampleupi
BankName string `json:"bankName"` // 银行名称
BankBranchName string `json:"bankBranchName"` // 银行子名称
IP string `json:"ip"` // ip
} }

@ -35,7 +35,7 @@ func AddUserBlackList(c *gin.Context) {
for _, v := range list { for _, v := range list {
info := common.WithdrawCommon{} info := common.WithdrawCommon{}
json.Unmarshal([]byte(v.PayAccount), &info) json.Unmarshal([]byte(v.PayAccount), &info)
acc := info.Number acc := info.BankCardNo
// if info.DrawType == common.WithdrawTypeBank { // if info.DrawType == common.WithdrawTypeBank {
// if info.BankCardNo != "" { // if info.BankCardNo != "" {
// acc = info.BankCardNo // acc = info.BankCardNo

@ -75,10 +75,10 @@ func (b *Base) WithdrawCallback(c *gin.Context) {
log.Error("order:%v not exist", orderID) log.Error("order:%v not exist", orderID)
return return
} }
if or.PayChannel != int(b.Channel) { // if or.PayChannel != int(b.Channel) {
log.Error("order:%v,pay channel:%v,this channel:%v", orderID, or.PayChannel, b.Channel) // log.Error("order:%v,pay channel:%v,this channel:%v", orderID, or.PayChannel, b.Channel)
return // return
} // }
if or.APIPayID == "" { if or.APIPayID == "" {
or.APIPayID = b.CallbackResp.APIOrderID or.APIPayID = b.CallbackResp.APIOrderID
} }

@ -73,7 +73,7 @@ func (s *Sub) GetResp() (proto.Message, error) {
func (s *Sub) PackPayReq() interface{} { func (s *Sub) PackPayReq() interface{} {
r := s.Base.PayReq r := s.Base.PayReq
send := &PayReq{ send := &PayReq{
Amount: r.Amount / 100, Amount: r.Amount,
Currency: "INR", Currency: "INR",
MerID: mid, MerID: mid,
NotifyURL: values.GetPayCallback(values.GoPay), NotifyURL: values.GetPayCallback(values.GoPay),
@ -94,7 +94,7 @@ func (s *Sub) PackWithdrawReq() interface{} {
return nil return nil
} }
send := &WithdrawReq{ send := &WithdrawReq{
Amount: r.Amount / 100, Amount: r.Amount,
Currency: "INR", Currency: "INR",
MerID: mid, MerID: mid,
NotifyURL: values.GetWithdrawCallback(values.GoPay), NotifyURL: values.GetWithdrawCallback(values.GoPay),

@ -96,7 +96,7 @@ func (s *Sub) PackPayReq() interface{} {
CustOrderNo: r.OrderID, CustOrderNo: r.OrderID,
TranType: tranType, TranType: tranType,
ClearType: "01", ClearType: "01",
PayAmt: r.Amount / 100, PayAmt: r.Amount,
BackUrl: values.GetPayCallback(values.GrePay), BackUrl: values.GetPayCallback(values.GrePay),
FrontUrl: values.GetFrontCallback(), FrontUrl: values.GetFrontCallback(),
GoodsName: "shopbuy", GoodsName: "shopbuy",
@ -123,7 +123,7 @@ func (s *Sub) PackWithdrawReq() interface{} {
CasType: "00", CasType: "00",
Country: "IN", Country: "IN",
Currency: "INR", Currency: "INR",
CasAmt: r.Amount / 100, CasAmt: r.Amount,
DeductWay: "02", DeductWay: "02",
CallBackUrl: values.GetWithdrawCallback(values.GrePay), CallBackUrl: values.GetWithdrawCallback(values.GrePay),
Account: config.GetConfig().Pay.GrePay.WithdrawAccount, Account: config.GetConfig().Pay.GrePay.WithdrawAccount,

@ -94,7 +94,7 @@ func (s *Sub) PackPayReq() interface{} {
ApplicationID: ApplicationId, ApplicationID: ApplicationId,
PayWay: 2, PayWay: 2,
PartnerOrderNo: r.OrderID, PartnerOrderNo: r.OrderID,
Amount: r.Amount / 100, Amount: r.Amount,
Currency: "INR", Currency: "INR",
Name: r.Name, Name: r.Name,
GameId: int(r.UID), GameId: int(r.UID),
@ -115,7 +115,7 @@ func (s *Sub) PackWithdrawReq() interface{} {
send := &WithdrawReq{ send := &WithdrawReq{
PartnerID: PartnerId, PartnerID: PartnerId,
PartnerWithdrawNo: r.OrderID, PartnerWithdrawNo: r.OrderID,
Amount: r.Amount / 100, Amount: r.Amount,
Currency: "INR", Currency: "INR",
GameId: fmt.Sprintf("%d", r.UID), GameId: fmt.Sprintf("%d", r.UID),
NotifyURL: values.GetWithdrawCallback(values.MLPay), NotifyURL: values.GetWithdrawCallback(values.MLPay),

@ -266,7 +266,7 @@ func TryWithdraw(or *common.WithdrawOrder) {
// Number: send.Number, // Number: send.Number,
UID: uint32(or.UID), UID: uint32(or.UID),
Channel: int64(or.UPI), Channel: int64(or.UPI),
Address: send.Address, // Address: send.Address,
IP: send.IP, IP: send.IP,
} }
channel := call.GetConfigWithdrawChannelsByID(int(req.Channel), common.CurrencyINR) channel := call.GetConfigWithdrawChannelsByID(int(req.Channel), common.CurrencyINR)

@ -14,14 +14,14 @@ func (g *Gin) CheckWithdrawCondition(amount int64, t common.CurrencyType) (ok bo
down, up := call.GetConfigWithdrawLimits() down, up := call.GetConfigWithdrawLimits()
if amount < down || amount > up { if amount < down || amount > up {
g.Code = values.CodeWithdrawCondition g.Code = values.CodeWithdrawCondition
g.Msg = fmt.Sprintf("O valor inserido deve estar entre R$ %s e R$ %s.", util.FormatNumberBrazil(float64(down)/common.DecimalDigits), util.FormatNumberBrazil(float64(up)/common.DecimalDigits)) g.Msg = fmt.Sprintf("दरज क गई रि R$ कच हिए %s और %s.", util.FormatNumberBrazil(float64(down)/common.DecimalDigits), util.FormatNumberBrazil(float64(up)/common.DecimalDigits))
return return
} }
// 拉取当前所需下注 // 拉取当前所需下注
bet := call.GetUserNeedBet(g.UID) bet := call.GetUserNeedBet(g.UID)
if bet > 0 { if bet > 0 {
g.Code = values.CodeWithdrawConditionBet g.Code = values.CodeWithdrawConditionBet
g.Msg = "Ainda não completou as apostas necessárias. É necessário fazê-lo antes de efetuar um levantamento." g.Msg = "आपन अभ तक आवशयक दव प नहिए ह। नि करन पहल यह कििए।"
return return
} }
vip := call.GetVIP(g.UID) vip := call.GetVIP(g.UID)
@ -31,7 +31,7 @@ func (g *Gin) CheckWithdrawCondition(amount int64, t common.CurrencyType) (ok bo
limit = con.Exp / common.DecimalDigits limit = con.Exp / common.DecimalDigits
} }
g.Code = values.CodeWithdrawConditionVip g.Code = values.CodeWithdrawConditionVip
g.Msg = fmt.Sprintf("Nível VIP insuficiente Seu valor de recarga deve chegar a R( $ %d para se tornar um VIP1 e poder sacar seu dinheiro.", limit) g.Msg = fmt.Sprintf("अपरत वआईपतर आपकप-अप रि R( $ %d VIP1 बनन और अपनिलन सकषम हि.", limit)
return return
} }
// con := call.GetVipCon(g.UID) // con := call.GetVipCon(g.UID)

@ -442,21 +442,24 @@ func ActivityFreeSpinInfo(c *gin.Context) {
a.GetUID() a.GetUID()
if a.UID > 0 { if a.UID > 0 {
freeSpin := call.GetUserFreeSpinData(a.UID) freeSpin := call.GetUserFreeSpinData(a.UID)
if freeSpin.LastSpin == 0 { if freeSpin.LastSpin == 0 && freeSpin.SpinNum == 0 {
now := time.Now().Unix() now := time.Now().Unix()
p, _ := call.GetUserXInfo(a.UID, "birth") p, _ := call.GetUserXInfo(a.UID, "birth")
data := &common.ActivityFreeSpinData{UID: a.UID} data := &common.ActivityFreeSpinData{UID: a.UID, SpinNum: common.DefaultFreeSpinNum}
if !util.IsSameDayTimeStamp(now, p.Birth) { if !util.IsSameDayTimeStamp(now, p.Birth) {
resp.Count = 1 resp.Count = data.SpinNum
} else {
data.LastSpin = now
} }
// } else {
// data.LastSpin = now
// }
db.Mysql().Create(data) db.Mysql().Create(data)
} else if !util.IsSameDayTimeStamp(time.Now().Unix(), freeSpin.LastSpin) { } else if !util.IsSameDayTimeStamp(time.Now().Unix(), freeSpin.LastSpin) {
resp.Count = 1 resp.Count = common.DefaultFreeSpinNum
} else {
resp.Count = freeSpin.SpinNum
} }
} else { } else {
resp.Count = 1 resp.Count = common.DefaultFreeSpinNum
} }
} }
@ -470,12 +473,11 @@ func ActivityFreeSpinDraw(c *gin.Context) {
} }
freeSpin := call.GetUserFreeSpinData(a.UID) freeSpin := call.GetUserFreeSpinData(a.UID)
now := time.Now().Unix() now := time.Now().Unix()
if config.GetBase().Release { if util.IsSameDayTimeStamp(now, freeSpin.LastSpin) && freeSpin.SpinNum <= 0 {
if util.IsSameDayTimeStamp(now, freeSpin.LastSpin) {
a.Code = values.CodeRetry a.Code = values.CodeRetry
return return
} }
}
resp := &values.ActivityFreeSpinDrawResp{} resp := &values.ActivityFreeSpinDrawResp{}
a.Data = resp a.Data = resp
@ -534,7 +536,8 @@ func ActivityFreeSpinDraw(c *gin.Context) {
if v.Type == common.ActivityFreeSpinItemRandomCash { if v.Type == common.ActivityFreeSpinItemRandomCash {
resp.Reward = rand.Int63n(v.CashUp-v.CashDown) + v.CashDown resp.Reward = rand.Int63n(v.CashUp-v.CashDown) + v.CashDown
} }
rows, err := db.Mysql().UpdateRes(&common.ActivityFreeSpinData{UID: a.UID, LastSpin: freeSpin.LastSpin}, map[string]interface{}{"last_spin": time.Now().Unix()}) rows, err := db.Mysql().UpdateRes(&common.ActivityFreeSpinData{UID: a.UID, LastSpin: freeSpin.LastSpin},
map[string]interface{}{"last_spin": time.Now().Unix(), "spin_num": gorm.Expr("spin_num - ?", 1)})
if rows == 0 || err != nil { if rows == 0 || err != nil {
a.Code = values.CodeRetry a.Code = values.CodeRetry
return return
@ -890,7 +893,6 @@ func ActivitySignDraw(c *gin.Context) {
first := util.GetZeroTime(time.Unix(data.Time, 0)).Unix() first := util.GetZeroTime(time.Unix(data.Time, 0)).Unix()
today := util.GetZeroTime(time.Now()).Unix() today := util.GetZeroTime(time.Now()).Unix()
day := int((today-first)/common.OneDay) + 1 day := int((today-first)/common.OneDay) + 1
// 最大签到天数 // 最大签到天数
if day > list[len(list)-1].Day { if day > list[len(list)-1].Day {
a.Code = values.CodeRetry a.Code = values.CodeRetry

@ -217,7 +217,6 @@ func PlayerRecharge(c *gin.Context) {
a.Msg = "channel unavailable" a.Msg = "channel unavailable"
return return
} }
// ok // ok
a.Data = payImp.Data a.Data = payImp.Data
a.Msg = payImp.Order.OrderID a.Msg = payImp.Order.OrderID
@ -309,12 +308,12 @@ func NewRechargeImp(req *values.RechargeReq, uid, cid int, ip string) *RechargeI
p.req.Name = util.GenerateRandomString(5) p.req.Name = util.GenerateRandomString(5)
p.req.Phone = pinfo.Mobile p.req.Phone = pinfo.Mobile
p.req.IP = ip p.req.IP = ip
p.req.Number = pinfo.Number p.req.Number = pinfo.BankCardNo
if info.Mobile != "" { if info.Mobile != "" {
p.req.Phone = info.Mobile p.req.Phone = info.Mobile
} }
if pinfo.Name != "" { if pinfo.AccountName != "" {
p.req.Name = pinfo.Name p.req.Name = pinfo.AccountName
} }
if pinfo.Email != "" { if pinfo.Email != "" {
p.req.Email = pinfo.Email p.req.Email = pinfo.Email

@ -218,7 +218,7 @@ func ShareWithdraw(c *gin.Context) {
} }
ip := a.GetRemoteIP() ip := a.GetRemoteIP()
payInfo, code := NewWithdraw(&values.WithdrawReq{PayAccount: req.PayAccount}, a.UID, ip) payInfo, code := NewWithdraw(&values.WithdrawReq{PayAccount: req.PayAccount}, a.UID, ip, a.UUID)
if code != values.CodeOK { if code != values.CodeOK {
a.Code = code a.Code = code
a.Msg = payInfo a.Msg = payInfo

@ -12,6 +12,7 @@ import (
"server/modules/web/values" "server/modules/web/values"
"server/pb" "server/pb"
"server/util" "server/util"
"strings"
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -279,7 +280,7 @@ func PlayerWithdraw(c *gin.Context) {
} }
ip := a.GetRemoteIP() ip := a.GetRemoteIP()
payInfo, code := NewWithdraw(req, uid, ip) payInfo, code := NewWithdraw(req, uid, ip, a.UUID)
if code != values.CodeOK { if code != values.CodeOK {
a.Code = code a.Code = code
a.Msg = payInfo a.Msg = payInfo
@ -349,7 +350,7 @@ func PlayerWithdraw(c *gin.Context) {
con := call.GetVipCon(uid) con := call.GetVipCon(uid)
realAmount := need // 实际打款 realAmount := need // 实际打款
if con != nil && con.Fee > 0 { if con != nil && con.Fee > 0 {
realAmount = common.RoundCurrency(req.CurrencyType, (1000-int64(con.Fee))*realAmount/1000) realAmount = common.RoundCurrency(req.CurrencyType, con.Fee) * realAmount
} }
var shouldAuto = false var shouldAuto = false
@ -406,76 +407,86 @@ func PlayerWithdraw(c *gin.Context) {
} }
// 返回值在code不为0的时候,代表错误msg // 返回值在code不为0的时候,代表错误msg
func NewWithdraw(req *values.WithdrawReq, uid int, ip string) (string, int) { func NewWithdraw(req *values.WithdrawReq, uid int, ip string, uuid string) (string, int) {
one := common.WithdrawCommon{} one := common.WithdrawCommon{}
err := mapstructure.Decode(req.PayAccount, &one) err := mapstructure.Decode(req.PayAccount, &one)
if err != nil || !one.PayType.Isvalid() { if err != nil || one.BankCode == "" {
log.Error("NewWithdrawImp err:%v,one:%+v", err, one) log.Error("NewWithdrawImp err:%v,one:%+v", err, one)
return "", values.CodeParam return "", values.CodeParam
} }
if one.PayType == common.PayTypeUPI {
return "The UPI channel is closed, please use the bank channel to withdraw cash.", values.CodeParam
}
if !one.PayType.Isvalid() {
log.Error("NewWithdrawImp err:%v,one:%+v", err, one)
return "", values.CodeParam
}
one.DeviceNo = uuid
one.AccountName = strings.TrimSpace(one.AccountName)
one.BankCardNo = strings.TrimSpace(one.BankCardNo)
one.BankCode = strings.TrimSpace(one.BankCode)
one.IP = ip one.IP = ip
// one.AccountName = strings.TrimSpace(one.AccountName) if one.PayType == common.PayTypeBank && len(one.BankCode) != 11 {
// one.BankCardNo = strings.TrimSpace(one.BankCardNo) return "The IFSC Code shall be 11 digital letters.", values.CodeParam
// one.BankCode = strings.TrimSpace(one.BankCode) }
// if one.DrawType == common.WithdrawTypeBank && len(one.BankCode) != 11 { if one.PayType == common.PayTypeBank && one.BankCardNo == "" && one.AccountName == "" && one.Email == "" {
// return "The IFSC Code shall be 11 digital letters.", values.CodeParam log.Error("NewWithdrawImp 银行卡支付,银行卡号不能为空 one:%+v", one)
// } return "The Bank Card No should not be empty.", values.CodeParam
// if one.DrawType == common.WithdrawTypeBank && one.BankCardNo == "" && one.AccountName == "" && one.Email == "" { }
// log.Error("NewWithdrawImp 银行卡支付,银行卡号不能为空 one:%+v", one) user, _ := call.GetUserXInfo(uid, "mobile")
// return "", values.CodeParam if user.Mobile == "" {
// } return "", values.CodeParam
// if one.DrawType != common.WithdrawTypeUPI && one.DrawType != common.WithdrawTypeBank { }
// log.Error("NewWithdrawImp unknown draw type one:%+v", one) _ = mapstructure.Decode(req.PayAccount, &one)
// return "", values.CodeParam if one.Mobile == "" {
// } one.Mobile = user.Mobile
// user, _ := call.GetUserXInfo(uid, "mobile") }
// if user.Mobile == "" {
// return "", values.CodeParam
// }
// mapstructure.Decode(req.PayAccount, &one)
// if one.Mobile == "" {
// one.Mobile = user.Mobile
// }
// 判断是否是拉黑用户,拉黑用户不让代付 // 判断是否是拉黑用户,拉黑用户不让代付
// blackData := &common.BlackList{Phone: one.Mobile, PayAccount: one.BankCardNo, Email: one.Email, Name: one.AccountName} blackData := &common.BlackList{Phone: one.Mobile, PayAccount: one.BankCardNo, Email: one.Email, Name: one.AccountName}
// if one.DrawType == common.WithdrawTypeUPI { if one.PayType == common.PayTypeUPI {
// blackData.PayAccount = one.BankCode blackData.PayAccount = one.BankCode
// } }
// if call.BlackListAndKick(uid, blackData) { if call.BlackListAndKick(uid, blackData) {
// return "", values.CodeRetry return "", values.CodeRetry
// } }
// 如果是银行那卡代付,验证ifsc // 如果是银行那卡代付,验证ifsc
// if one.DrawType == common.WithdrawTypeBank { if one.PayType == common.PayTypeBank {
// if !call.CheckIFSC(one.BankCode) { if !call.CheckIFSC(one.BankCode) {
// return "The IFSC Code is invalid.", values.CodeParam return "The IFSC Code is invalid.", values.CodeParam
// } }
// } }
// 查询该银行卡是否已经绑定其他账号 // 查询该银行卡是否已经绑定其他账号
// pi := &common.PayInfo{UID: uid} pi := &common.PayInfo{UID: uid}
// db.Mysql().Get(pi) _ = db.Mysql().Get(pi)
// if one.DrawType == common.WithdrawTypeBank { if one.PayType == common.PayTypeBank {
// if pi.BankCardNo != one.BankCardNo { if pi.BankCardNo != one.BankCardNo {
// sql := fmt.Sprintf("bank_card_no = '%v'", one.BankCardNo) sql := fmt.Sprintf("bank_card_no = '%v'", one.BankCardNo)
// if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) { if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) {
// return "", values.CodeBankCardNoLimit return "", values.CodeBankCardNoLimit
// } }
// } }
// } else if one.DrawType == common.WithdrawTypeUPI { // UPI } else if one.PayType == common.PayTypeUPI { // UPI
// if pi.BankCode != one.BankCode { if pi.BankCode != one.BankCode {
// sql := fmt.Sprintf("bank_code = '%v'", one.BankCode) sql := fmt.Sprintf("bank_code = '%v'", one.BankCode)
// if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) { if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) {
// return "", values.CodeBankCardNoLimit return "", values.CodeBankCardNoLimit
// } }
// } }
// } }
info := &common.PayInfo{ info := &common.PayInfo{
UID: uid, UID: uid,
Name: one.Name, DeviceNo: one.DeviceNo,
// Device: one.Device,
PhoneModel: one.Model,
OperatorOs: one.OperatorOs,
AccountName: one.AccountName,
Mobile: one.Mobile, Mobile: one.Mobile,
Email: one.Email, Email: one.Email,
BankCardNo: one.BankCardNo,
PayType: one.PayType, PayType: one.PayType,
Number: one.Number, BankCode: one.BankCode,
// Address: one.Address,
} }
if _, err := db.Mysql().Upsert(fmt.Sprintf("uid = %v", uid), info); err != nil { if _, err := db.Mysql().Upsert(fmt.Sprintf("uid = %v", uid), info); err != nil {
return "", values.CodeParam return "", values.CodeParam
@ -584,7 +595,10 @@ func (p *PayWithdraw) Withdraw() error {
req.Name = send.Name req.Name = send.Name
req.Email = send.Email req.Email = send.Email
req.PayType = int64(send.PayType) req.PayType = int64(send.PayType)
req.Address = send.Address req.PayCode = send.BankCode
req.CardNo = send.BankCardNo
req.Name = send.AccountName
} }
ret, err := call.Withdraw(req) ret, err := call.Withdraw(req)
if ret != nil { if ret != nil {
@ -594,7 +608,10 @@ func (p *PayWithdraw) Withdraw() error {
log.Error("err:%v", err) log.Error("err:%v", err)
return err return err
} }
or := &common.RechargeOrder{Status: common.StatusROrderPay, APIPayID: ret.APIOrderID, PaySource: common.PaySourceModulePay, PayChannel: int(ret.Channel)}
or := &common.WithdrawOrder{
Status: common.StatusROrderPay, APIPayID: ret.APIOrderID,
PaySource: common.PaySourceModulePay}
or.ID = order.ID or.ID = order.ID
res := db.Mysql().C().Model(order).Updates(or) res := db.Mysql().C().Model(order).Updates(or)
err = res.Error err = res.Error
@ -629,7 +646,9 @@ func (p *PayWithdraw) AutoWithdraw() error {
req.Name = send.Name req.Name = send.Name
req.Email = send.Email req.Email = send.Email
req.PayType = int64(send.PayType) req.PayType = int64(send.PayType)
req.Address = send.Address req.BankName = send.BankName
req.CardNo = send.BankCode
// req.Address = send.Address
// req.Number = send.Number // req.Number = send.Number
} else { } else {
req.Address = order.PayAccount req.Address = order.PayAccount

@ -32,4 +32,5 @@ const (
CodeRecharge // 需要充值 CodeRecharge // 需要充值
CodeWithdrawConditionVip // 未到达vip退出条件 CodeWithdrawConditionVip // 未到达vip退出条件
CodeWithdrawConditionBet // 未到达打码退出条件 CodeWithdrawConditionBet // 未到达打码退出条件
CodeBankCardNoLimit // 银行卡号限制
) )

Loading…
Cancel
Save