优化结构
This commit is contained in:
@@ -25,9 +25,10 @@ func SeedDemoOrders(db *gorm.DB, now time.Time) (*DemoSeedResult, error) {
|
||||
if !db.Migrator().HasTable(&paymentOrderPO{}) || !db.Migrator().HasTable(&paymentEventPO{}) {
|
||||
return nil, fmt.Errorf("payment tables are not migrated")
|
||||
}
|
||||
now = now.UTC().Truncate(time.Second)
|
||||
if now.IsZero() {
|
||||
now = time.Now().UTC().Truncate(time.Second)
|
||||
} else {
|
||||
now = now.UTC().Truncate(time.Second)
|
||||
}
|
||||
|
||||
type demoOrder struct {
|
||||
@@ -37,7 +38,7 @@ func SeedDemoOrders(db *gorm.DB, now time.Time) (*DemoSeedResult, error) {
|
||||
makeOrder := func(index int, provider, subject, status, fulfillment, refund string, amount int64, currency string, created time.Time) paymentOrderPO {
|
||||
tradeNo := fmt.Sprintf("%s%02d", DemoTradePrefix, index)
|
||||
return paymentOrderPO{
|
||||
TradeNo: tradeNo, Provider: provider, BusinessType: "demo_subscription", BusinessID: fmt.Sprintf("DEMO-LICENSE-%02d", index),
|
||||
TradeNo: tradeNo, Provider: provider, BusinessType: bizpayment.DemoBusinessType, BusinessID: fmt.Sprintf("DEMO-LICENSE-%02d", index),
|
||||
Subject: subject, PaymentMode: bizpayment.PaymentModeExternal, OriginalAmount: amount, Amount: amount,
|
||||
Currency: currency, PaymentStatus: status, FulfillmentStatus: fulfillment, RefundStatus: refund,
|
||||
ConfirmationID: uuid.NewString(), RequestFingerprint: fmt.Sprintf("demo-fingerprint-%02d", index),
|
||||
|
||||
Reference in New Issue
Block a user