Documentation
¶
Index ¶
- type Amount
- type BaseDBHandler
- func (b *BaseDBHandler[T]) Create(tx *gorm.DB, model *T) (*T, error)
- func (b *BaseDBHandler[T]) Delete(tx *gorm.DB, idField string, idValue interface{}, version uint64) error
- func (b *BaseDBHandler[T]) GetDB(tx *gorm.DB) *gorm.DB
- func (b *BaseDBHandler[T]) GetDBWithoutTx() *gorm.DB
- func (b *BaseDBHandler[T]) GetList(condition interface{}, pageSize, page int, includeDeleted bool, ...) ([]T, uint64, error)
- func (b *BaseDBHandler[T]) GetOne(condition interface{}, includeDeleted bool) (*T, error)
- func (b *BaseDBHandler[T]) Update(tx *gorm.DB, model *T) error
- type BatchStatusResponse
- type GoodsDetail
- type HardwareResponse
- type MerchantPaymentConfig
- type Payer
- type PaymentKafKa
- type PaymentResponse
- type PromotionDetail
- type SceneInfo
- type Versioned
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Amount ¶
type BaseDBHandler ¶
BaseDBHandler 提供了一个基础结构体,包含 GetDB 方法
func (*BaseDBHandler[T]) Create ¶
func (b *BaseDBHandler[T]) Create(tx *gorm.DB, model *T) (*T, error)
Create 创建记录
func (*BaseDBHandler[T]) Delete ¶
func (b *BaseDBHandler[T]) Delete(tx *gorm.DB, idField string, idValue interface{}, version uint64) error
Delete 删除记录
func (*BaseDBHandler[T]) GetDB ¶
func (b *BaseDBHandler[T]) GetDB(tx *gorm.DB) *gorm.DB
GetDB 提供数据库连接或事务
func (*BaseDBHandler[T]) GetDBWithoutTx ¶
func (b *BaseDBHandler[T]) GetDBWithoutTx() *gorm.DB
GetDBWithoutTx 提供基础数据库连接
func (*BaseDBHandler[T]) GetList ¶
func (b *BaseDBHandler[T]) GetList(condition interface{}, pageSize, page int, includeDeleted bool, orderByAndDirection ...string) ([]T, uint64, error)
GetList 获取记录列表,支持分页和排序(排序字段和方向可选)
func (*BaseDBHandler[T]) GetOne ¶
func (b *BaseDBHandler[T]) GetOne(condition interface{}, includeDeleted bool) (*T, error)
GetOne 获取单条记录
func (*BaseDBHandler[T]) Update ¶
func (b *BaseDBHandler[T]) Update(tx *gorm.DB, model *T) error
Update 更新记录
type BatchStatusResponse ¶
type BatchStatusResponse struct {
OutBatchNo string `json:"out_batch_no"` // 批次号
BatchID string `json:"batch_id"` // 批次 ID
BatchStatus string `json:"batch_status"` // 批次状态
TotalNum int `json:"total_num"` // 总笔数
TotalAmount int `json:"total_amount"` // 总金额(单位:分)
SuccessAmount int `json:"success_amount"` // 成功金额(单位:分)
SuccessNum int `json:"success_num"` // 成功笔数
FailAmount int `json:"fail_amount"` // 失败金额(单位:分)
FailNum int `json:"fail_num"` // 失败笔数
Mchid string `json:"mchid"` // 商户号
UpdateTime time.Time `json:"update_time"` // 更新时间
}
BatchStatusResponse 定义与 JSON 数据结构匹配的结构体
type GoodsDetail ¶
type HardwareResponse ¶
type MerchantPaymentConfig ¶
type MerchantPaymentConfig struct {
ID uint64 `json:"id"` // 主键ID
CompanyID uint64 `json:"company_id"` // 所属公司ID,关联公司表
AppID string `json:"app_id"` // 微信支付应用ID
MchID string `json:"mch_id"` // 微信支付商户号
APIKey string `json:"api_key"` // 微信支付API密钥
PrivateKey string `json:"private_key"` // 微信支付证书私钥
SerialNo string `json:"serial_no"` // 微信支付证书序列号
NotifyURL string `json:"notify_url"` // 支付回调通知URL
Description string `json:"description"` // 支付参数描述
Status uint8 `json:"status"` // 状态: 1-启用, 0-禁用
}
MerchantPaymentConfig 支付参数表
type PaymentKafKa ¶
type PaymentKafKa struct {
ID int64 `gorm:"primaryKey;autoIncrement;comment:主键ID"` // 主键ID
TransactionID string `gorm:"type:varchar(64);not null;index:idx_transaction_id;comment:交易ID"` // TransactionID: 交易ID
Amount uint64 `gorm:"type:decimal(18,2);not null;comment:金额"` // Amount: 金额
MchID string `gorm:"type:varchar(64);not null;comment:商户号"` // MchID: 商户号
TradeState string `gorm:"type:varchar(32);not null;default:'';comment:交易状态"` // TradeState: 交易状态
BankType string `gorm:"type:varchar(32);default:'';comment:银行类型"` // BankType: 银行类型
SuccessTime time.Time `gorm:"type:datetime;not null;comment:支付成功时间"` // SuccessTime: 支付成功时间
OutTradeNo string `gorm:"type:varchar(64);not null;index:idx_out_trade_no;comment:商户订单号"` // OutTradeNo: 商户订单号
AppID string `gorm:"type:varchar(64);not null;comment:应用ID"` // AppID: 应用ID
TradeStateDesc string `gorm:"type:varchar(256);default:'';comment:交易状态描述"` // TradeStateDesc: 交易状态描述
TradeType string `gorm:"type:varchar(32);default:'';comment:交易类型"` // TradeType: 交易类型
Attach string `gorm:"type:text;default:'';comment:附加数据"` // Attach: 附加数据
SceneInfoID int64 `gorm:"default:0;comment:场景信息ID"` // SceneInfoID: 场景信息ID
OpenID string `gorm:"type:varchar(64);not null;default:'';comment:支付用户openID"` // OpenID: 支付用户openID
CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp;comment:创建时间"` // CreatedAt: 创建时间
UpdatedAt *time.Time `gorm:"type:timestamp;default:null;comment:更新时间"` // UpdatedAt: 更新时间
}
PaymentKafKa 表
type PaymentResponse ¶
type PaymentResponse struct {
TransactionID string `json:"transaction_id"`
Amount Amount `json:"amount"`
MchID string `json:"mchid"`
TradeState string `json:"trade_state"`
BankType string `json:"bank_type"`
PromotionDetail []PromotionDetail `json:"promotion_detail"`
SuccessTime time.Time `json:"success_time"`
Payer Payer `json:"payer"`
OutTradeNo string `json:"out_trade_no"`
AppID string `json:"appid"`
TradeStateDesc string `json:"trade_state_desc"`
TradeType string `json:"trade_type"`
Attach string `json:"attach"`
SceneInfo SceneInfo `json:"scene_info"`
}
type PromotionDetail ¶
type PromotionDetail struct {
Amount int `json:"amount"`
WechatpayContribute int `json:"wechatpay_contribute"`
CouponID string `json:"coupon_id"`
Scope string `json:"scope"`
MerchantContribute int `json:"merchant_contribute"`
Name string `json:"name"`
OtherContribute int `json:"other_contribute"`
Currency string `json:"currency"`
StockID string `json:"stock_id"`
GoodsDetail []GoodsDetail `json:"goods_detail"`
}
Source Files
¶
- BaseDBHandler.go
- PaymentResponse.go
- batch_status_response.go
- control.go
- merchant_payment_config.go
- payment.go
Click to show internal directories.
Click to hide internal directories.