- 添加IStoreSkuSorter接口,但当前无实际平台支持

This commit is contained in:
gazebo
2019-09-04 11:42:58 +08:00
parent 4be654fc3e
commit 0bdcdde11c
6 changed files with 120 additions and 18 deletions

View File

@@ -2,8 +2,9 @@ package partner
import (
"math"
"time"
"regexp"
"time"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
@@ -39,6 +40,7 @@ type StoreSkuInfo struct {
Stock int `json:"stock,omitempty"`
VendorPrice int64 `json:"price,omitempty"`
Status int `json:"status,omitempty"`
Seq int `json:"seq,omitempty"`
}
type SkuInfo struct {
@@ -94,6 +96,21 @@ func (l BareStoreSkuInfoList) GetSkuIDList() (skuIDList []int) {
return skuIDList
}
func (l BareStoreSkuInfoList) Len() int {
return len(l)
}
func (l BareStoreSkuInfoList) Less(i, j int) bool {
if l[i].Seq != l[j].Seq {
return l[i].Seq < l[j].Seq
}
return l[i].VendorPrice < l[j].VendorPrice
}
func (l BareStoreSkuInfoList) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
type BareCategoryInfo struct {
VendorCatID string `json:"vendorCatID"`
@@ -141,6 +158,10 @@ type ISingleStoreStoreSkuHandler interface {
GetSensitiveWordRegexp() *regexp.Regexp
}
type IStoreSkuSorter interface {
ReorderStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, vendorCatID string, storeSkuList []*StoreSkuInfo) (err error)
}
func BuildSkuName(skuID int, vendorSkuID string) (skuName *SkuNameInfo) {
return &SkuNameInfo{
SkuList: []*SkuInfo{