99 lines
3.6 KiB
Go
99 lines
3.6 KiB
Go
package model
|
||
|
||
const (
|
||
StoreStatusDisabled = -1
|
||
StoreStatusClosed = 0
|
||
StoreStatusOpened = 1
|
||
)
|
||
|
||
const (
|
||
MainSubStoreName = "本店"
|
||
MainSubStoreAddress = "本店"
|
||
)
|
||
|
||
// 配送范围类型,此定义与京东到家相同,除非特殊说明,本系统中的坐标都是火星坐标
|
||
const (
|
||
DeliveryRangeTypePolygon = 2
|
||
DeliveryRangeTypeRadius = 3
|
||
)
|
||
|
||
type Store struct {
|
||
ModelIDCUL
|
||
|
||
Name string `orm:"size(255);unique" json:"name"`
|
||
CityCode int `orm:"default(0);null" json:"cityCode"` // todo ?
|
||
DistrictCode int `orm:"default(0);null" json:"districtCode"` // todo ?
|
||
Address string `orm:"size(255)" json:"address"`
|
||
Tel1 string `orm:"size(32);index" json:"tel1"`
|
||
Tel2 string `orm:"size(32);index" json:"tel2"`
|
||
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半,用两个的原因是为了支持中午休息,1与2的时间段不能交叉,为0表示没有
|
||
CloseTime1 int16 `json:"closeTime1"` // 格式同上
|
||
OpenTime2 int16 `json:"openTime2"` // 格式同上
|
||
CloseTime2 int16 `json:"closeTime2"` // 格式同上
|
||
Lng int `json:"lng"` // 乘了10的6次方
|
||
Lat int `json:"lat"` // 乘了10的6次方
|
||
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
|
||
DeliveryRange string `orm:"size(2048)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米
|
||
Status int `json:"status"`
|
||
|
||
DeliveryType int8 `orm:"-" json:"-"`
|
||
}
|
||
|
||
type StoreSub struct {
|
||
ModelIDCUL
|
||
|
||
StoreID int `orm:"column(store_id)"`
|
||
Index int // 子店序号,为0表示主店
|
||
Name string `orm:"size(255);index"`
|
||
Address string `orm:"size(255)"`
|
||
Status int // 取值同Store.Status
|
||
Mobile1 string `orm:"size(32)"`
|
||
Mobile2 string `orm:"size(32)"`
|
||
Mobile3 string `orm:"size(32)"`
|
||
}
|
||
|
||
func (*StoreSub) TableUnique() [][]string {
|
||
return [][]string{
|
||
[]string{"StoreID", "Index"},
|
||
}
|
||
}
|
||
|
||
type StoreMap struct {
|
||
ModelIDCUL
|
||
|
||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||
Status int `json:"status"` // 取值同Store.Status
|
||
|
||
PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格
|
||
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
||
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
|
||
DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争
|
||
|
||
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
|
||
}
|
||
|
||
func (*StoreMap) TableUnique() [][]string {
|
||
return [][]string{
|
||
[]string{"StoreID", "VendorID"},
|
||
[]string{"VendorStoreID", "VendorID"},
|
||
}
|
||
}
|
||
|
||
type StoreCourierMap struct {
|
||
ModelIDCUL
|
||
|
||
StoreID int `orm:"column(store_id)"`
|
||
VendorID int `orm:"column(vendor_id)"`
|
||
VendorStoreID string `orm:"column(vendor_store_id);size(48)"`
|
||
Status int
|
||
}
|
||
|
||
func (*StoreCourierMap) TableUnique() [][]string {
|
||
return [][]string{
|
||
[]string{"StoreID", "VendorID"},
|
||
[]string{"VendorStoreID", "VendorID"},
|
||
}
|
||
}
|