This commit is contained in:
suyl
2021-07-22 17:23:55 +08:00
parent 12d6688b6f
commit 46e420a892
2 changed files with 34 additions and 0 deletions

33
business/model/order.go Normal file
View File

@@ -0,0 +1,33 @@
package model
import "time"
type PayOrder struct {
ID int64 `orm:"column(id)" json:"id"`
CreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
OrderID string `orm:"column(order_id)" json:"orderID"` //订单号
UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID
OrderType int `json:"orderType"` //订单类型,流量充值等
Origin string `json:"origin"` //订单来源,小程序,开放后台
Status int `json:"status"` //订单状态,待支付2已支付5支付成功110支付失败115
PayPrice int `json:"payPrice"` //支付金额
TransactionID string `orm:"column(transaction_id);size(48)" json:"transactionID"` // 支付成功后支付方生成的事务ID
PayFinishedAt time.Time `orm:"type(datetime);null" json:"payFinishedAt"`
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后支付前支付方生成的事务ID
OriginalData string `orm:"type(text)" json:"-"`
Comment string `orm:"size(255)" json:"comment"` //备注
ThingID string `orm:"column(thing_id)" json:"thing_id"` //订单充值项目ID
}
func (v *PayOrder) TableUnique() [][]string {
return [][]string{
[]string{"OrderID"},
}
}
func (v *PayOrder) TableIndex() [][]string {
return [][]string{
[]string{"CreatedAt"},
[]string{"UserID"},
}
}

View File

@@ -19,6 +19,7 @@ func Init() {
orm.RegisterModel(&model.Menu{})
orm.RegisterModel(&model.MenuDetail{})
orm.RegisterModel(&model.SimFlowExpend{}, &model.SimFlowIncome{})
orm.RegisterModel(&model.PayOrder{})
// create table
orm.RunSyncdb("default", false, true)
}