All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m6s
53 lines
2.5 KiB
Go
53 lines
2.5 KiB
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"time"
|
|
|
|
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
|
)
|
|
|
|
type Payment struct {
|
|
ID uint `gorm:"column:id;primaryKey" json:"id"`
|
|
PaymentNo string `gorm:"column:payment_no;type:varchar(40);uniqueIndex;not null" json:"payment_no"`
|
|
OrderID uint `gorm:"column:order_id;not null" json:"order_id"`
|
|
OrderType string `gorm:"column:order_type;type:varchar(30);not null" json:"order_type"`
|
|
PaymentMethod string `gorm:"column:payment_method;type:varchar(20);not null" json:"payment_method"`
|
|
MerchantIdentity string `gorm:"column:merchant_identity;type:varchar(100)" json:"-"`
|
|
Amount int64 `gorm:"column:amount;type:bigint;not null" json:"amount"`
|
|
Status int `gorm:"column:status;type:smallint;not null;default:0" json:"status"`
|
|
ThirdPartyTradeNo string `gorm:"column:third_party_trade_no;type:varchar(100)" json:"third_party_trade_no,omitempty"`
|
|
PaymentConfigID *uint `gorm:"column:payment_config_id" json:"payment_config_id,omitempty"`
|
|
PaymentVoucherKey string `gorm:"column:payment_voucher_key;type:varchar(500)" json:"payment_voucher_key,omitempty"`
|
|
QRContent string `gorm:"column:qr_content;type:text" json:"-"`
|
|
PaidAt *time.Time `gorm:"column:paid_at" json:"paid_at,omitempty"`
|
|
ExpireAt *time.Time `gorm:"column:expire_at" json:"expire_at,omitempty"`
|
|
CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index" json:"deleted_at,omitempty"`
|
|
}
|
|
|
|
func (Payment) TableName() string {
|
|
return "tb_payment"
|
|
}
|
|
|
|
const (
|
|
PaymentRecordStatusPending = constants.PaymentRecordStatusPending // 待支付
|
|
PaymentRecordStatusPaid = constants.PaymentRecordStatusPaid // 已支付
|
|
PaymentRecordStatusFailed = constants.PaymentRecordStatusFailed // 已失败
|
|
PaymentRecordStatusRefunded = constants.PaymentRecordStatusRefunded // 已退款
|
|
)
|
|
|
|
const (
|
|
PaymentOrderTypePackage = "package_order" // 套餐订单
|
|
PaymentOrderTypeRecharge = "recharge_order" // 客户充值订单
|
|
PaymentOrderTypeAgentRecharge = "agent_recharge" // 代理充值订单
|
|
)
|
|
|
|
const (
|
|
PaymentByWallet = "wallet"
|
|
PaymentByWechat = "wechat"
|
|
PaymentByAlipay = "alipay"
|
|
PaymentByOffline = "offline"
|
|
)
|