pay权重下限配置

mlpay代付修复
fix/release
mofangmin 1 year ago
parent d647df7367
commit cce1c2842c
  1. 14
      modules/pay/mlpay/base.go
  2. 10
      modules/pay/values/values.go
  3. 1
      modules/web/handler/recharge.go

@ -72,14 +72,14 @@ func (s *Sub) GetResp() (proto.Message, error) {
log.Debug("resp:%v", s.Base.Resp) log.Debug("resp:%v", s.Base.Resp)
if s.Base.Opt == base.OPTPay { if s.Base.Opt == base.OPTPay {
resp := s.Base.Resp.(*PayResp) resp := s.Base.Resp.(*PayResp)
if resp.Data == "" { if resp.Code != "0000" {
return nil, errors.New("pay fail") return nil, errors.New("pay fail " + resp.Msg)
} }
return &pb.InnerRechargeResp{APIOrderID: s.Base.PayReq.OrderID, URL: resp.Data, Channel: uint32(values.MLPay)}, nil return &pb.InnerRechargeResp{APIOrderID: s.Base.PayReq.OrderID, URL: resp.Data, Channel: uint32(values.MLPay)}, nil
} else if s.Base.Opt == base.OPTWithdraw { } else if s.Base.Opt == base.OPTWithdraw {
resp := s.Base.Resp.(*WithdrawResp) resp := s.Base.Resp.(*WithdrawResp)
if s.Base.Status == 0 && resp.Code == "0000" { if resp.Code != "0000" {
return nil, errors.New("withdraw fail") return nil, errors.New("withdraw fail " + resp.Msg)
} }
return &pb.InnerWithdrawResp{APIOrderID: resp.Data, Channel: uint32(values.MLPay)}, nil return &pb.InnerWithdrawResp{APIOrderID: resp.Data, Channel: uint32(values.MLPay)}, nil
} }
@ -152,17 +152,11 @@ func (s *Sub) CheckSign(str string) bool {
req := s.Base.CallbackReq.(*PayCallbackReq) req := s.Base.CallbackReq.(*PayCallbackReq)
s.Base.CallbackResp.OrderID = req.PartnerOrderNo s.Base.CallbackResp.OrderID = req.PartnerOrderNo
s.Base.CallbackResp.APIOrderID = req.OrderNo s.Base.CallbackResp.APIOrderID = req.OrderNo
// if req.Status == 1 {
// return false
// }
s.Base.CallbackResp.Success = req.Status == 1 s.Base.CallbackResp.Success = req.Status == 1
sign = req.Sign sign = req.Sign
} else if s.Base.Opt == base.OPTWithdrawCB { } else if s.Base.Opt == base.OPTWithdrawCB {
req := s.Base.CallbackReq.(*WithdrawCallbackReq) req := s.Base.CallbackReq.(*WithdrawCallbackReq)
s.Base.CallbackResp.OrderID = req.PartnerWithdrawNo s.Base.CallbackResp.OrderID = req.PartnerWithdrawNo
// if req.Status == 1 {
// return false
// }
s.Base.CallbackResp.Success = req.Status == 1 s.Base.CallbackResp.Success = req.Status == 1
sign = req.Sign sign = req.Sign
} }

@ -449,8 +449,14 @@ func AddWithdrawChannel(p int, amount int) {
} }
func AddPayChannel(p int, amount int) { func AddPayChannel(p int, amount int) {
if err := db.Mysql().C().Model(&common.ConfigPayChannels{}).Where("channel_id = ?", p).Updates(map[string]interface{}{"pay_per": gorm.Expr("pay_per + ?", amount)}).Error; err != nil { channel := &common.ConfigPayChannels{
log.Error("err:%v", err) ChannelID: p,
}
db.Mysql().Get(&channel)
if channel.PayPer+amount > 100 {
if err := db.Mysql().C().Model(&common.ConfigPayChannels{}).Where("channel_id = ?", p).Updates(map[string]interface{}{"pay_per": gorm.Expr("pay_per + ?", amount)}).Error; err != nil {
log.Error("err:%v", err)
}
} }
} }

@ -207,6 +207,7 @@ func PlayerRecharge(c *gin.Context) {
payImp := NewRechargeImp(req, a.UID, a.Channel, a.GetRemoteIP()) payImp := NewRechargeImp(req, a.UID, a.Channel, a.GetRemoteIP())
if payImp == nil { if payImp == nil {
a.Code = values.CodeRetry a.Code = values.CodeRetry
a.Msg = "channel unavailable"
log.Error("req params err:%v", req) log.Error("req params err:%v", req)
return return
} }

Loading…
Cancel
Save