feat:优化项目信息
This commit is contained in:
@ -145,6 +145,8 @@ func (this *Instance) Handle() {
|
||||
// 活动管理
|
||||
&synchronized{iModel: model.NewActivityInstance()}, &synchronized{iModel: model.NewActivityApply()},
|
||||
&synchronized{iModel: model.NewActivityApplyLog()}, &synchronized{iModel: model.NewActivityJoin()},
|
||||
// 订单管理
|
||||
&synchronized{iModel: model.NewOrderInstance()}, &synchronized{iModel: model.NewOrderLog()},
|
||||
)
|
||||
fmt.Printf("========================\n=== 数据完成迁移,成功【%d】,失败【%d】 ===\n========================\n",
|
||||
successCount, failureCount)
|
||||
|
75
app/common/model/order_instance.go
Normal file
75
app/common/model/order_instance.go
Normal file
@ -0,0 +1,75 @@
|
||||
package model
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// OrderInstance 订单数据模型
|
||||
type OrderInstance struct {
|
||||
Model
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Channel string `gorm:"column:channel;type:varchar(30);default:'';comment:订单支付渠道" json:"channel"`
|
||||
OrderNo string `gorm:"column:order_no;type:varchar(30);default:'';comment:订单号" json:"order_no"`
|
||||
Amount float64 `gorm:"column:amount;type:decimal(10,2);default:0;comment:订单金额" json:"amount"`
|
||||
Params string `gorm:"column:params;type:varchar(255);default:'';comment:订单参数" json:"-"`
|
||||
Status OrderInstanceStatus `gorm:"column:status;type:tinyint(1);default:0;comment:订单状态" json:"status"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:订单备注" json:"remark"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
// OrderInstanceParams 订单参数
|
||||
type OrderInstanceParams struct {
|
||||
Kind OrderInstanceParamsKind `json:"kind"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// OrderInstanceParamsKind 订单参数类型信息
|
||||
type OrderInstanceParamsKind int
|
||||
|
||||
const (
|
||||
// OrderInstanceParamsKindForActivity 活动信息
|
||||
OrderInstanceParamsKindForActivity OrderInstanceParamsKind = iota + 1e2 + 1
|
||||
)
|
||||
|
||||
// OrderInstanceParamsForActivity 订单活动参数
|
||||
type OrderInstanceParamsForActivity struct {
|
||||
ID uint64 `json:"id"`
|
||||
}
|
||||
|
||||
// OrderInstanceStatus 订单状态
|
||||
type OrderInstanceStatus int
|
||||
|
||||
const (
|
||||
// OrderInstanceStatusForInvalid 失效-未在规定时间内支付
|
||||
OrderInstanceStatusForInvalid OrderInstanceStatus = iota - 9
|
||||
// OrderInstanceStatusForCancel 取消-用户主动取消订单
|
||||
OrderInstanceStatusForCancel OrderInstanceStatus = iota - 2
|
||||
// OrderInstanceStatusForInit 初始化-初始化订单,待支付
|
||||
OrderInstanceStatusForInit
|
||||
// OrderInstanceStatusForPaid 已支付
|
||||
OrderInstanceStatusForPaid
|
||||
// OrderInstanceStatusForComplete 完成
|
||||
OrderInstanceStatusForComplete
|
||||
)
|
||||
|
||||
func (m *OrderInstance) TableName() string {
|
||||
return "order_instance"
|
||||
}
|
||||
|
||||
func (m *OrderInstance) SetParamsAttribute(kind OrderInstanceParamsKind, data interface{}) {
|
||||
value := &OrderInstanceParams{Kind: kind, Data: data}
|
||||
_bytes, _ := json.Marshal(value)
|
||||
m.Params = string(_bytes)
|
||||
}
|
||||
|
||||
func (m *OrderInstance) GetParamsAttribute() *OrderInstanceParams {
|
||||
out := new(OrderInstanceParams)
|
||||
|
||||
_ = json.Unmarshal([]byte(m.Params), out)
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
func NewOrderInstance() *OrderInstance {
|
||||
return &OrderInstance{}
|
||||
}
|
19
app/common/model/order_log.go
Normal file
19
app/common/model/order_log.go
Normal file
@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
// OrderLog 订单日志信息模型
|
||||
type OrderLog struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
OrderID uint64 `gorm:"column:uid;type:int(11);default:0;comment:订单ID" json:"-"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注" json:"remark"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *OrderLog) TableName() string {
|
||||
return "order_log"
|
||||
}
|
||||
|
||||
func NewOrderLog() *OrderLog {
|
||||
return &OrderLog{}
|
||||
}
|
Reference in New Issue
Block a user