- first compilable version of order handler.

This commit is contained in:
gazebo
2018-07-10 13:37:35 +08:00
parent 49ec11baf8
commit a76213e8f0
15 changed files with 1319 additions and 5 deletions

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

@@ -0,0 +1,108 @@
package model
import "time"
type ModelTimeInfo struct {
CreatedAt time.Time `orm:"auto_now_add;type(datetime)"`
UpdatedAt time.Time `orm:"auto_now;type(datetime)"`
}
type Order struct {
ID int64 `orm:"column(id)"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)"`
VendorID int `orm:"column(vendor_id)"`
VendorStoreID string `orm:"column(vendor_store_id);size(48)"`
StoreID int `orm:"column(store_id)"` // 外部系统里记录的 jxstoreid
JxStoreID int `orm:"column(jx_store_id)"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
StoreName string `orm:"size(64)"`
SubStoreID int `orm:"column(sub_store_id)"`
SubStoreName string `orm:"size(64)"`
ShopPrice int64
SalePrice int64
ConsigneeName string `orm:"size(32)"`
ConsigneeMobile string `orm:"size(32)"`
SkuCount int
Status int
VendorStatus string `orm:"size(16)"`
LockStatus int
CancelApplyReason string `orm:"size(255);null;default(null)"` // null表示没有申请不为null表示用户正在取消申请
WaybillVendorID int `orm:"column(waybill_vendor_id)"`
OriginalData string `orm:"type(text)"`
OrderCreatedAt time.Time `orm:"type(datetime);index"`
OrderFinishedAt time.Time `orm:"type(datetime)"`
ModelTimeInfo
}
func (o *Order) TableUnique() [][]string {
return [][]string{
[]string{"VendorOrderID", "VendorID"},
}
}
type OrderSku struct {
ID int64 `orm:"column(id)"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)"`
VendorID int `orm:"column(vendor_id)"`
Count int
VendorSkuID string `orm:"column(vendor_sku_id),size(48)"`
SkuID int `orm:"column(sku_id)"` // 外部系统里记录的 jxskuid
JxSkuID int `orm:"column(jx_sku_id)"` // 根据VendorSkuID在本地系统里查询出来的 jxskuid
SkuName string `orm:"size(255)"`
ShopPrice int64
SalePrice int64
OrderCreatedAt time.Time `orm:"type(datetime);index"`
}
func (o *OrderSku) TableUnique() [][]string {
return [][]string{
[]string{"VendorOrderID", "SkuID", "VendorID"},
}
}
type Waybill struct {
ID int64 `orm:"column(id)"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)"`
VendorID int `orm:"column(vendor_id)"`
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)"`
VendorWaybillID2 string `orm:"column(vendor_waybill_id2);size(48)"`
WaybillVendorID int `orm:"column(waybill_vendor_id)"`
CourierName string `orm:"size(32)"`
CourierMobile string `orm:"size(32)"`
Status int
VendorStatus string `orm:"size(16)"`
ActualFee int64
WaybillCreatedAt time.Time `orm:"type(datetime);index"`
WaybillFinishedAt time.Time `orm:"type(datetime)"`
ModelTimeInfo
}
func (w *Waybill) TableUnique() [][]string {
return [][]string{
[]string{"VendorWaybillID", "WaybillVendorID"},
}
}
func (w *Waybill) TableIndex() [][]string {
return [][]string{
[]string{"VendorOrderID"},
}
}
// 包含定单与运单的状态及事件vendor status
type OrderStatus struct {
ID int64 `orm:"column(id)"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)"`
VendorID int `orm:"column(vendor_id)"`
OrderType int // 0:定单1运单
Status int // 如果Status为OrderStatusEvent表示VendorStatus只是一个事件不是状态
VendorStatus string `orm:"size(16)"`
StatusTime time.Time `orm:"type(datetime);index"`
Count int `orm:"default(1)"`
ModelTimeInfo
}
func (v *OrderStatus) TableIndex() [][]string {
return [][]string{
[]string{"VendorOrderID", "Status"},
}
}