优化表结构,重构模型,重新实现基于白银网关的提取节点流程
This commit is contained in:
@@ -4,8 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"platform/web/core"
|
||||
bill2 "platform/web/domains/bill"
|
||||
trade2 "platform/web/domains/trade"
|
||||
g "platform/web/globals"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
@@ -27,7 +25,7 @@ func (s *userService) UpdateBalanceByTrade(uid int32, info *RechargeProductInfo,
|
||||
}
|
||||
|
||||
// 生成账单
|
||||
err = q.Bill.Create(bill2.NewForRecharge(uid, Bill.GenNo(), info.GetSubject(), info.GetAmount(), trade))
|
||||
err = q.Bill.Create(newForRecharge(uid, Bill.GenNo(), info.GetSubject(), info.GetAmount(), trade))
|
||||
if err != nil {
|
||||
return core.NewServErr("生成账单失败", err)
|
||||
}
|
||||
@@ -73,8 +71,8 @@ type RechargeProductInfo struct {
|
||||
Amount int `json:"amount"`
|
||||
}
|
||||
|
||||
func (r *RechargeProductInfo) GetType() trade2.Type {
|
||||
return trade2.TypeRecharge
|
||||
func (r *RechargeProductInfo) GetType() m.TradeType {
|
||||
return m.TradeTypeRecharge
|
||||
}
|
||||
|
||||
func (r *RechargeProductInfo) GetSubject() string {
|
||||
@@ -96,13 +94,13 @@ func (r *RechargeProductInfo) Deserialize(str string) error {
|
||||
|
||||
type UserOnTradeComplete struct{}
|
||||
|
||||
func (u UserOnTradeComplete) Check(t trade2.Type) (trade2.ProductInfo, bool) {
|
||||
if t == trade2.TypeRecharge {
|
||||
func (u UserOnTradeComplete) Check(t m.TradeType) (ProductInfo, bool) {
|
||||
if t == m.TradeTypeRecharge {
|
||||
return &RechargeProductInfo{}, true
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (u UserOnTradeComplete) OnTradeComplete(info trade2.ProductInfo, trade *m.Trade) error {
|
||||
func (u UserOnTradeComplete) OnTradeComplete(info ProductInfo, trade *m.Trade) error {
|
||||
return User.UpdateBalanceByTrade(trade.UserID, info.(*RechargeProductInfo), trade)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user