Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Failing after 3m55s
新增收款商户、商户池轮询、微信授权配置独立管理;三类新支付 (C端套餐购买、C端资产钱包充值、代理在线预存款充值)无条件 经商户池选择并冻结路由,无旧综合配置回退。merchant_id 为空 历史支付继续按 payment_config_id 双读。凭证版本化加载与 ID+版本缓存保证轮换一致性。删除商户池新支付创建开关及全部 引用。
61 lines
3.7 KiB
Go
61 lines
3.7 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:"-"`
|
|
MerchantID *uint `gorm:"column:merchant_id" json:"merchant_id,omitempty"`
|
|
MerchantPoolID *uint `gorm:"column:merchant_pool_id" json:"merchant_pool_id,omitempty"`
|
|
MerchantNameSnapshot string `gorm:"column:merchant_name_snapshot" json:"merchant_name_snapshot,omitempty"`
|
|
MerchantPaymentMethodSnapshot string `gorm:"column:merchant_payment_method_snapshot" json:"merchant_payment_method_snapshot,omitempty"`
|
|
MerchantProviderTypeSnapshot string `gorm:"column:merchant_provider_type_snapshot" json:"merchant_provider_type_snapshot,omitempty"`
|
|
MerchantPoolNameSnapshot string `gorm:"column:merchant_pool_name_snapshot" json:"merchant_pool_name_snapshot,omitempty"`
|
|
RoutingStrategySnapshot string `gorm:"column:routing_strategy_snapshot" json:"routing_strategy_snapshot,omitempty"`
|
|
RoutingEpoch *int64 `gorm:"column:routing_epoch" json:"routing_epoch,omitempty"`
|
|
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"
|
|
)
|