+ StoreMap.PricePercentagePack

This commit is contained in:
gazebo
2019-07-15 15:37:45 +08:00
parent 598a9738e8
commit ae4dff1b2d
5 changed files with 96 additions and 14 deletions

View File

@@ -227,11 +227,14 @@ type StoreMap struct {
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"` // 配送类型
DeliveryFee int `json:"deliveryFee"`
DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争
PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格
PricePercentagePack string `orm:"size(4096)" json:"pricePercentagePack"` //
PricePercentagePackObj PricePercentagePack `orm:"-" json:"-"`
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
DeliveryFee int `json:"deliveryFee"`
DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
IsSync int8 `orm:"default(1)" json:"isSync"` // 是否同步
@@ -303,3 +306,27 @@ func (v *VendorStoreSnapshot) CompareOperationTime(s2 *VendorStoreSnapshot) int
}
return 1
}
type PricePercentageItem struct {
BeginPrice int `json:"beginPrice"` // 启始价格区间(包括)
PricePercentage int `json:"pricePercentage"` // 调价比例
}
type PricePercentagePack []*PricePercentageItem
func (l PricePercentagePack) Len() int {
return len(l)
}
// Less reports whether the element with
// index i should sort before the element with index j.
func (l PricePercentagePack) Less(i, j int) bool {
return l[i].BeginPrice < l[j].BeginPrice
}
// Swap swaps the elements with indexes i and j.
func (l PricePercentagePack) Swap(i, j int) {
tmp := l[i]
l[i] = l[j]
l[j] = tmp
}