You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package payment
|
|
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
|
|
// PaymentType 支付类型
|
|
|
|
|
type PaymentType int8
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
TypeArticle PaymentType = 1 // 文章支付
|
|
|
|
|
TypeColumn PaymentType = 2 // 专栏支付
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// PaymentStatus 支付状态
|
|
|
|
|
type PaymentStatus int8
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
StatusPending PaymentStatus = 0 // 待支付
|
|
|
|
|
StatusSuccess PaymentStatus = 1 // 支付成功
|
|
|
|
|
StatusFailed PaymentStatus = 2 // 支付失败
|
|
|
|
|
StatusCancelled PaymentStatus = 3 // 已取消
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Payment 支付订单实体
|
|
|
|
|
type Payment struct {
|
|
|
|
|
ID uint64 `json:"id" xorm:"pk autoincr 'id'"`
|
|
|
|
|
OrderNo string `json:"order_no" xorm:"varchar(32) notnull unique 'order_no'"` // 商户订单号
|
|
|
|
|
TransactionID string `json:"transaction_id" xorm:"varchar(32) 'transaction_id'"` // 微信支付订单号
|
|
|
|
|
UserID uint64 `json:"user_id" xorm:"not null 'user_id'"` // 用户ID
|
|
|
|
|
TargetID uint64 `json:"target_id" xorm:"not null 'target_id'"` // 目标ID(文章ID或专栏ID)
|
|
|
|
|
Type PaymentType `json:"type" xorm:"not null 'type'"` // 支付类型
|
|
|
|
|
Amount int64 `json:"amount" xorm:"not null 'amount'"` // 支付金额(分)
|
|
|
|
|
Status PaymentStatus `json:"status" xorm:"not null default 0 'status'"` // 支付状态
|
|
|
|
|
Description string `json:"description" xorm:"varchar(255) 'description'"` // 商品描述
|
|
|
|
|
NotifyData string `json:"notify_data" xorm:"text 'notify_data'"` // 回调数据
|
|
|
|
|
CreatedAt time.Time `json:"created_at" xorm:"created 'created_at'"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at" xorm:"updated 'updated_at'"`
|
|
|
|
|
DeletedAt *time.Time `json:"deleted_at" xorm:"deleted 'deleted_at'"`
|
|
|
|
|
}
|