This commit is contained in:
laodaming
2023-06-15 19:14:19 +08:00
parent 51a33052d9
commit 4a5d84fb22
12 changed files with 458 additions and 14 deletions

View File

@@ -0,0 +1,26 @@
package gmodel
import (
"gorm.io/gorm"
)
type FsPay struct {
Id int64 `gorm:"primary_key" json:"id"` //
UserId *int64 `gorm:"" json:"user_id"` // 用户id
OrderNumber *string `gorm:"" json:"order_number"` // 订单编号
TradeNo *string `gorm:"" json:"trade_no"` // 第三方支付编号
PayAmount *int64 `gorm:"" json:"pay_amount"` // 支付金额 (分)
PayStatus *int64 `gorm:"" json:"pay_status"` // 支付状态 0 不成功 1 成功
IsRefund *int64 `gorm:"" json:"is_refund"` // 是否退款 0 未退款 1退款
PaymentMethod *int64 `gorm:"" json:"payment_method"` // 支付方式 1 stripe 2 paypal
PayStage *int64 `gorm:"" json:"pay_stage"` // 支付阶段 1首付 2尾款
OrderSource *int64 `gorm:"" json:"order_source"` // 订单来源 1pc
PayTime *int64 `gorm:"" json:"pay_time"` // 支付时间
CreatedAt *int64 `gorm:"" json:"created_at"` // 创建时间
UpdatedAt *int64 `gorm:"" json:"updated_at"` // 更新时间
CardNo *string `gorm:"" json:"card_no"` // 卡后4位
Brand *string `gorm:"" json:"brand"` // 银行品牌
}
type FsPayModel struct{ db *gorm.DB }
func NewFsPayModel(db *gorm.DB) *FsPayModel { return &FsPayModel{db} }

View File

@@ -0,0 +1,11 @@
package gmodel
import "context"
func (p *FsPayModel) GetListByOrderNumber(ctx context.Context, sn string) (resp []FsPay, err error) {
err = p.db.WithContext(ctx).Model(&FsPay{}).Where("`order_number` = ? ", sn).Find(&resp).Error
if err != nil {
return nil, err
}
return resp, nil
}