package model import "time" // PaymentConfig 支付渠道配置(单行表,固定使用 ID=1)。 // 敏感字段(APIv3 密钥、应用私钥)以 AES-GCM 密文入库,绝不存明文。 // Logan.Li type PaymentConfig struct { ID uint `json:"id" gorm:"primaryKey"` Mode string `json:"mode" gorm:"size:10;default:'test'"` // test / live // ============ 微信支付(APIv3) ============ WechatEnabled bool `json:"wechat_enabled" gorm:"default:false"` WechatMchID string `json:"wechat_mch_id" gorm:"size:64"` WechatAppID string `json:"wechat_app_id" gorm:"size:64"` WechatAPIv3KeyEnc string `json:"-" gorm:"column:wechat_apiv3_key_enc;type:text"` // AES-GCM 密文 WechatSerialNo string `json:"wechat_serial_no" gorm:"size:128"` // 商户 API 证书序列号 WechatCertPath string `json:"-" gorm:"column:wechat_cert_path;size:512"` // apiclient_cert.pem 落地路径 WechatKeyPath string `json:"-" gorm:"column:wechat_key_path;size:512"` // apiclient_key.pem 落地路径 WechatPlatformCertPath string `json:"-" gorm:"column:wechat_platform_cert_path;size:512"` WechatPayMethods string `json:"wechat_pay_methods" gorm:"size:64;default:'native'"` // 逗号分隔 native,h5,jsapi // ============ 支付宝(开放平台) ============ AlipayEnabled bool `json:"alipay_enabled" gorm:"default:false"` AlipayAppID string `json:"alipay_app_id" gorm:"size:64"` AlipayPrivateKeyEnc string `json:"-" gorm:"column:alipay_private_key_enc;type:text"` // AES-GCM 密文(粘贴来源) AlipayPublicKeyEnc string `json:"-" gorm:"column:alipay_public_key_enc;type:text"` // AES-GCM 密文(粘贴来源) AlipayPrivateKeyPath string `json:"-" gorm:"column:alipay_private_key_path;size:512"` AlipayPublicKeyPath string `json:"-" gorm:"column:alipay_public_key_path;size:512"` AlipayGateway string `json:"alipay_gateway" gorm:"size:255"` AlipaySignType string `json:"alipay_sign_type" gorm:"size:20;default:'RSA2'"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // TableName 指定表名 // Logan.Li func (PaymentConfig) TableName() string { return "payment_configs" }