|
@@ -4,6 +4,7 @@ import (
|
|
|
"errors"
|
|
|
logger "eta/eta_mini_ht_api/common/component/log"
|
|
|
"eta/eta_mini_ht_api/models"
|
|
|
+ merchantDao "eta/eta_mini_ht_api/models/merchant"
|
|
|
"fmt"
|
|
|
"github.com/go-sql-driver/mysql"
|
|
|
"gorm.io/gorm"
|
|
@@ -34,25 +35,26 @@ const (
|
|
|
)
|
|
|
|
|
|
type ProductOrder struct {
|
|
|
- ID int `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
|
|
- OrderID string `gorm:"column:order_id;size:255;comment:'订单编号'" json:"order_id"`
|
|
|
- UserID int `gorm:"column:user_id;default:null;comment:'用户id'" json:"user_id"`
|
|
|
- TemplateUserID int `gorm:"column:template_user_id;default:null;comment:'临时用户id'" json:"template_user_id"`
|
|
|
- ProductID int `gorm:"column:product_id;default:null;comment:'产品id'" json:"product_id"`
|
|
|
- TotalAmount string `gorm:"column:total_amount;size:255;default:null;comment:'金额'" json:"total_amount"`
|
|
|
- TradeID int `gorm:"column:trade_id;default:null;comment:'支付订单'" json:"trade_id"`
|
|
|
- TradeNO string `gorm:"column:trade_no;default:null;comment:'支付订单'" json:"trade_no"`
|
|
|
- RefundAmount string `gorm:"column:refund_amount;size:255;default:null;comment:'退款金额'" json:"refund_amount"`
|
|
|
- PaymentWay PaymentWay `gorm:"column:payment_way;enum('wechat','alipay');default:null;comment:'支付渠道'"`
|
|
|
- PaymentTime time.Time `gorm:"column:payment_time;default:null;comment:'支付时间'" json:"payment_time"`
|
|
|
- ExpiredTime time.Time `gorm:"column:expired_time;default:null;comment:'超时时间'" json:"expired_time"`
|
|
|
- Status OrderStatus `gorm:"column:status;type:enum('pending','processing','paid','closed','refund');default:'pending';comment:'订单状态'" json:"status"`
|
|
|
- RefundStatus RefundStatus `gorm:"column:refund_status;type:enum('pending','processing','failed','success');default:null;comment:'退款状态'" json:"refund_status"`
|
|
|
- RefundFinishTime time.Time `gorm:"column:refund_finish_time;default:null;comment:'退款完成时间'" json:"refund_finish_time"`
|
|
|
- Remark string `gorm:"column:remark;size:255;default:null;comment:'备注'" json:"remark"`
|
|
|
- IsDeleted int `gorm:"column:is_deleted;size:1;default:0;comment:'是否删除'" json:"is_deleted"`
|
|
|
- CreatedTime time.Time `gorm:"column:created_time;default:null;comment:'创建时间'" json:"created_time"`
|
|
|
- UpdatedTime time.Time `gorm:"column:updated_time;default:null;comment:'更新时间'" json:"updated_time"`
|
|
|
+ ID int `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
|
|
+ OrderID string `gorm:"column:order_id;size:255;comment:'订单编号'" json:"order_id"`
|
|
|
+ UserID int `gorm:"column:user_id;default:null;comment:'用户id'" json:"user_id"`
|
|
|
+ TemplateUserID int `gorm:"column:template_user_id;default:null;comment:'临时用户id'" json:"template_user_id"`
|
|
|
+ ProductID int `gorm:"column:product_id;default:null;comment:'产品id'" json:"product_id"`
|
|
|
+ ProductType merchantDao.MerchantProductType `gorm:"column:product_type;default:null;comment:'产品类型'" json:"product_type"`
|
|
|
+ TotalAmount string `gorm:"column:total_amount;size:255;default:null;comment:'金额'" json:"total_amount"`
|
|
|
+ TradeID int `gorm:"column:trade_id;default:null;comment:'支付订单'" json:"trade_id"`
|
|
|
+ TradeNO string `gorm:"column:trade_no;default:null;comment:'支付订单'" json:"trade_no"`
|
|
|
+ RefundAmount string `gorm:"column:refund_amount;size:255;default:null;comment:'退款金额'" json:"refund_amount"`
|
|
|
+ PaymentWay PaymentWay `gorm:"column:payment_way;enum('wechat','alipay');default:null;comment:'支付渠道'"`
|
|
|
+ PaymentTime time.Time `gorm:"column:payment_time;default:null;comment:'支付时间'" json:"payment_time"`
|
|
|
+ ExpiredTime time.Time `gorm:"column:expired_time;default:null;comment:'超时时间'" json:"expired_time"`
|
|
|
+ Status OrderStatus `gorm:"column:status;type:enum('pending','processing','paid','closed','refund');default:'pending';comment:'订单状态'" json:"status"`
|
|
|
+ RefundStatus RefundStatus `gorm:"column:refund_status;type:enum('pending','processing','failed','success');default:null;comment:'退款状态'" json:"refund_status"`
|
|
|
+ RefundFinishTime time.Time `gorm:"column:refund_finish_time;default:null;comment:'退款完成时间'" json:"refund_finish_time"`
|
|
|
+ Remark string `gorm:"column:remark;size:255;default:null;comment:'备注'" json:"remark"`
|
|
|
+ IsDeleted int `gorm:"column:is_deleted;size:1;default:0;comment:'是否删除'" json:"is_deleted"`
|
|
|
+ CreatedTime time.Time `gorm:"column:created_time;default:null;comment:'创建时间'" json:"created_time"`
|
|
|
+ UpdatedTime time.Time `gorm:"column:updated_time;default:null;comment:'更新时间'" json:"updated_time"`
|
|
|
}
|
|
|
|
|
|
func (pr *ProductOrder) BeforeCreate(db *gorm.DB) (err error) {
|