修改部分枚举字段的编号与注释确保 0 值的正确语义
This commit is contained in:
@@ -134,12 +134,23 @@ func (s *transactionService) PrepareTransaction(ctx context.Context, q *q.Query,
|
||||
}
|
||||
|
||||
// 保存交易订单
|
||||
var tradeType int
|
||||
var billType int
|
||||
switch tType {
|
||||
case TransactionTypeRecharge:
|
||||
tradeType = 2
|
||||
billType = 3
|
||||
case TransactionTypePurchase:
|
||||
tradeType = 1
|
||||
billType = 1
|
||||
}
|
||||
|
||||
var trade = m.Trade{
|
||||
UserID: uid,
|
||||
InnerNo: tradeNo,
|
||||
Subject: subject,
|
||||
Method: int32(method),
|
||||
Type: int32(tType),
|
||||
Type: int32(tradeType),
|
||||
Amount: amount,
|
||||
Status: 0, // 0-待支付
|
||||
PayURL: payUrl,
|
||||
@@ -155,7 +166,7 @@ func (s *transactionService) PrepareTransaction(ctx context.Context, q *q.Query,
|
||||
UserID: uid,
|
||||
TradeID: trade.ID,
|
||||
Info: subject,
|
||||
Type: int32(tType),
|
||||
Type: int32(billType),
|
||||
Amount: amount,
|
||||
}
|
||||
err = q.Bill.
|
||||
@@ -329,8 +340,8 @@ func (s *transactionService) FinishTransaction(ctx context.Context, q *q.Query,
|
||||
type TransactionType int32
|
||||
|
||||
const (
|
||||
TransactionTypeRecharge TransactionType = iota
|
||||
TransactionTypePurchase
|
||||
TransactionTypePurchase TransactionType = iota + 1
|
||||
TransactionTypeRecharge
|
||||
)
|
||||
|
||||
type TransactionMethod int32
|
||||
|
||||
Reference in New Issue
Block a user