ea支付;优惠券

dev_aagame_provider
zhora 3 weeks ago
parent 5150e96939
commit a61dde85f5
  1. 4
      call/item.go
  2. 1
      call/mail.go
  3. 4
      call/pay.go
  4. 10
      common/activity.go
  5. 4
      common/player.go
  6. 2
      modules/pay/eanipay/base.go
  7. 2
      modules/pay/moonpay2/base.go
  8. 20
      modules/web/handler/recharge.go
  9. 20
      modules/web/values/pay.go

@ -15,8 +15,8 @@ func GetUserItem(uid, itemID int) []*common.PlayerItems {
return list
}
func GetItem(id int) *common.PlayerItems {
list := &common.PlayerItems{ID: id, Status: common.ItemStatusNormal}
func GetItem(id, uid int) *common.PlayerItems {
list := &common.PlayerItems{ID: id, UID: uid, Status: common.ItemStatusNormal}
db.Mysql().Get(&list)
return list
}

@ -99,6 +99,7 @@ func SendMailWithContent(uid int, title, content string) {
Receiver: uid,
Title: title,
Content: content,
Tag: 1,
Time: time.Now().Unix(),
}
db.Mysql().Create(one)

@ -302,10 +302,10 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s
if bonus > 0 {
UploadActivityData(uid, common.ActivityIDRecharge, common.ActivityDataJoin, bonus)
}
if r.ProductID == 0 {
if r.ActivityID == 0 {
ticket := GetConfigDiscountTicketByAmount(discountOriginAmount)
log.Info("ticket:%v", ticket)
if ticket.ID > 0 {
log.Info("ticket:%v", ticket)
// 赠送优惠券
tickets := GetConfigDiscountTicket()
sort.Slice(tickets, func(i, j int) bool {

@ -531,11 +531,15 @@ func (m *ConfigActivityPopup) TableName() string {
}
type ConfigDiscountTicket struct {
ID int `gorm:"column:id;type:int(11) AUTO_INCREMENT;primary_key" json:"id"`
ID int `gorm:"column:id;type:int(11) AUTO_INCREMENT;primary_key" json:"id"`
// 充值额度(单位分)
RechargeAmount int64 `gorm:"column:recharge_amount;type:bigint(20)" web:"recharge_amount"`
// 满减金额(单位分)
DiscountAmount int64 `gorm:"column:discount_amount;type:bigint(20)" web:"discount_amount"`
CurProb int `gorm:"column:cur_prob;type:int(11)" web:"cur_prob"`
NextProb int `gorm:"column:next_prob;type:int(11)" web:"next_prob"`
// 本档位概率
CurProb int `gorm:"column:cur_prob;type:int(11)" web:"cur_prob"`
// 向上档位概率
NextProb int `gorm:"column:next_prob;type:int(11)" web:"next_prob"`
}
func (m *ConfigDiscountTicket) TableName() string {

@ -178,8 +178,8 @@ type PlayerItems struct {
ItemID int `gorm:"column:item_id;default:0;comment:物品id"`
Time int64 `gorm:"column:time;type:bigint(20);default:0;comment:获得的时间"`
Status int `gorm:"column:status;type:int(11);default:0;comment:物品状态"`
Exi1 int64 `gorm:"column:exi1;type:bigint(20);default:0;comment:物品标识字段1"`
Exi2 int64 `gorm:"column:exi2;type:bigint(20);default:0;comment:物品标识字段2"`
Exi1 int64 `gorm:"column:exi1;type:bigint(20);default:0;comment:物品标识字段1"` // 优惠金额
Exi2 int64 `gorm:"column:exi2;type:bigint(20);default:0;comment:物品标识字段2"` // 额度
Exi3 int64 `gorm:"column:exi3;type:bigint(20);default:0;comment:物品标识字段3"`
}

@ -97,7 +97,6 @@ func (s *Sub) GetResp() (proto.Message, error) {
func (s *Sub) PackPayReq() interface{} {
r := s.Base.PayReq
r.Amount /= 100
if len(r.Phone) == 12 {
r.Phone = r.Phone[2:]
}
@ -122,7 +121,6 @@ func (s *Sub) PackPayReq() interface{} {
func (s *Sub) PackWithdrawReq() interface{} {
r := s.Base.WithdrawReq
r.Amount /= 100
if len(r.Phone) == 12 {
r.Phone = r.Phone[2:]
}

@ -142,7 +142,6 @@ func (s *Sub) PackPayReq() interface{} {
if len(r.Phone) == 12 {
r.Phone = r.Phone[2:]
}
r.Amount /= 100
send := &PayReq{
MerchantID: mid,
OrderNumber: r.OrderID,
@ -162,7 +161,6 @@ func (s *Sub) PackWithdrawReq() interface{} {
if len(r.Phone) == 12 {
r.Phone = r.Phone[2:]
}
r.Amount /= 100
send := &WithdrawReq{
MerchantID: mid,
OrderNumber: r.OrderID,

@ -151,11 +151,15 @@ func RechargeInfo(c *gin.Context) {
})
continue
}
if v.Time == -1 {
diff = 0
}
resp.DiscountTicket = append(resp.DiscountTicket, &values.DiscountTicket{
Id: v.ID,
Discount: v.Exi1,
TimeLeft: v.Time,
Amount: v.Exi2,
Id: v.ID,
Discount: v.Exi1,
TimeLeftAt: v.Time,
TimeLeft: diff,
Amount: v.Exi2,
})
}
}
@ -329,11 +333,10 @@ func NewRechargeImp(req *values.RechargeReq, uid, cid int, ip string) *RechargeI
}
}
}
// 只有商城购买才能使用优惠券
// todo activityId为0才是商城购买
if req.ProductID == 0 && req.DiscountTicketId > 0 {
// 使用了优惠券
if req.DiscountTicketId > 0 {
// 判断是否有折扣券
ticket := call.GetItem(req.DiscountTicketId)
ticket := call.GetItem(req.DiscountTicketId, uid)
if ticket != nil && req.Amount >= ticket.Exi2 {
ticketData := common.ActivityRechargeData{ID: common.ItemDiscountTicket, I1: int(ticket.Exi1), I2: req.Amount}
ticketByte, _ := json.Marshal(ticketData)
@ -346,6 +349,7 @@ func NewRechargeImp(req *values.RechargeReq, uid, cid int, ip string) *RechargeI
//notCharge := re.TotalRecharge == 0
//per := call.GetConfigFirstPayPerByAmount(notCharge, order.Amount)
var times int
// todo bonus赠送 且 非活动
if req.Bonus && req.ActivityID == 0 {
buyCount, per, topThree := call.GetConfigFirstPayByCount(order.UID, order.Amount, re.BuyAmountDataMap)
if per > 0 {

@ -44,10 +44,11 @@ type RechargeInfoFirstResp struct {
}
type DiscountTicket struct {
Id int
Discount int64
TimeLeft int64
Amount int64
Id int
Discount int64 // 优惠额度
TimeLeftAt int64 // 过期时间
TimeLeft int64 // 过期时间
Amount int64 // 充值挡位
}
// RechargeReq 充值请求 地址格式为:{"city":"Mumbai","street":"sarang street","houseNumber":"-54/a"}
@ -55,12 +56,11 @@ type RechargeReq struct {
CurrencyType common.CurrencyType `json:"CurrencyType"`
PayChannel int `json:"PayChannel"`
DiscountTicketId int `json:"DiscountTicketId"` // 折扣券ID
Amount int64 `json:"amount"`
Bonus bool `json:"bonus"`
ProductID int `json:"productId"`
ActivityID int `json:"activityID"`
Amount int64 `json:"amount"`
Bonus bool `json:"bonus"`
ProductID int `json:"productId"`
ActivityID int `json:"activityID"`
DiscountTicketId int `json:"discountTicketId"` // 折扣券ID
UserName *string `json:"userName"` // 用户姓名
UserPhone string `json:"userPhone"` // 用户手机号

Loading…
Cancel
Save