85 lines
2.5 KiB
Go
85 lines
2.5 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
PromotionStatusLocalCreated = 0 // 本地成功创建,
|
|
PromotionStatusRemoteFailed = 1 // 远程创建失败,
|
|
PromotionStatusRemoteCreated = 2 // 远程成功创建,
|
|
PromotionStatusCanceled = 3 // 被显示取消
|
|
PromotionStatusEnded = 4 // 已经超过活动时间,且被显示置为结束
|
|
)
|
|
|
|
const (
|
|
PromotionCreateTypeByJX = 0
|
|
PromotionCreateTypeByVendor = 1
|
|
)
|
|
|
|
var (
|
|
PromotionStatusName = map[int]string{
|
|
PromotionStatusLocalCreated: "未确认",
|
|
PromotionStatusRemoteFailed: "失败",
|
|
PromotionStatusRemoteCreated: "正常",
|
|
PromotionStatusCanceled: "取消",
|
|
PromotionStatusEnded: "结束",
|
|
}
|
|
)
|
|
|
|
type Promotion struct {
|
|
ModelIDCULD
|
|
|
|
VendorID int `orm:"column(vendor_id)"`
|
|
Name string `orm:"size(64)" json:"name"`
|
|
Advertising string `orm:"size(255)" json:"advertising"`
|
|
Type int `json:"type"`
|
|
Status int `json:"status"`
|
|
LimitDevice int8 `json:"limitDevice"`
|
|
LimitPin int8 `json:"limitPin"`
|
|
LimitDaily int8 `json:"limitDaily"`
|
|
LimitCount int `json:"limitCount"`
|
|
Source string `orm:"size(255)" json:"source"`
|
|
CreateType int8 `json:"createType"`
|
|
VendorPromotionID string `orm:"size(64);column(vendor_promotion_id);index" json:"vendorPromotionID"`
|
|
BeginAt time.Time `orm:"type(datetime);index" json:"beginAt"`
|
|
EndAt time.Time `orm:"type(datetime);index" json:"endAt"`
|
|
Remark string `orm:"type(text)" json:"-"`
|
|
}
|
|
|
|
func (*Promotion) TableUnique() [][]string {
|
|
return [][]string{
|
|
[]string{"Name", "VendorID", "Type", "DeletedAt"},
|
|
}
|
|
}
|
|
|
|
type PromotionStore struct {
|
|
ModelIDCULD
|
|
|
|
PromotionID int `orm:"column(promotion_id)" json:"promotionID"`
|
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
|
}
|
|
|
|
func (*PromotionStore) TableUnique() [][]string {
|
|
return [][]string{
|
|
[]string{"PromotionID", "StoreID", "DeletedAt"},
|
|
}
|
|
}
|
|
|
|
type PromotionSku struct {
|
|
ModelIDCULD
|
|
|
|
PromotionID int `orm:"column(promotion_id)" json:"promotionID"`
|
|
SkuID int `orm:"column(sku_id)" json:"skuID"`
|
|
PriceType int `json:"priceType"`
|
|
Price int `json:"price"` // 分,活动价,这个不是单价
|
|
LimitSkuCount int `json:"limitSkuCount"`
|
|
IsLock int8 `json:"isLock"` // 是否锁定门店商品信息
|
|
}
|
|
|
|
func (*PromotionSku) TableUnique() [][]string {
|
|
return [][]string{
|
|
[]string{"PromotionID", "SkuID", "DeletedAt"},
|
|
}
|
|
}
|