This commit is contained in:
laodaming
2023-06-16 18:24:31 +08:00
parent 47bf9580da
commit 175583ca51
8 changed files with 427 additions and 19 deletions

View File

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

View File

@@ -9,3 +9,10 @@ func (p *FsPayModel) GetListByOrderNumber(ctx context.Context, sn string) (resp
}
return resp, nil
}
func (p *FsPayModel) GetOrderPayList(ctx context.Context, sn string, payStatus int64, isRefund int64) (resp []FsPay, err error) {
err = p.db.WithContext(ctx).Model(&FsPay{}).Where("`order_number` = ? and `pay_status` = ? and `is_refund` = ?", sn, payStatus, isRefund).Find(&resp).Error
if err != nil {
return nil, err
}
return resp, nil
}