130 lines
4.2 KiB
Go
130 lines
4.2 KiB
Go
package partner
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
|
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
|
)
|
|
|
|
const (
|
|
FuncGetStoreSkusBareInfo = 1
|
|
FuncUpdateStoreSkusStock = 2
|
|
FuncUpdateStoreSkusStatus = 3
|
|
FuncUpdateStoreSkusPrice = 4
|
|
|
|
FuncGetStoreSkusFullInfo = 6
|
|
FuncCreateStoreSkus = 7
|
|
FuncUpdateStoreSkus = 8
|
|
FuncDeleteStoreSkus = 9
|
|
)
|
|
|
|
type StoreSkuInfo struct {
|
|
SkuID int `json:"skuID,omitempty"`
|
|
VendorSkuID string `json:"vendorSkuID,omitempty"`
|
|
NameID int `json:"nameID,omitempty"`
|
|
VendorNameID string `json:"vendorNameID,omitempty"`
|
|
|
|
Stock int `json:"stock,omitempty"`
|
|
Price int64 `json:"price,omitempty"`
|
|
Status int `json:"status,omitempty"`
|
|
}
|
|
|
|
type SkuInfo struct {
|
|
StoreSkuInfo
|
|
SkuName string
|
|
Comment string
|
|
SpecQuality float64
|
|
SpecUnit string
|
|
Weight int
|
|
ActPrice int64
|
|
}
|
|
|
|
type SkuNameInfo struct {
|
|
NameID int `json:"nameID,omitempty"`
|
|
VendorNameID string `json:"vendorNameID,omitempty"`
|
|
|
|
Prefix string
|
|
Name string
|
|
Description string
|
|
Unit string
|
|
VendorCatIDList []string
|
|
PictureList []string
|
|
Status int `json:"status,omitempty"`
|
|
SkuList []*SkuInfo
|
|
}
|
|
|
|
type BareStoreSkuInfoList []*StoreSkuInfo
|
|
|
|
func (l BareStoreSkuInfoList) GetVendorSkuIDList() (vendorSkuIDList []string) {
|
|
for _, v := range l {
|
|
if !dao.IsVendorThingIDEmpty(v.VendorSkuID) {
|
|
vendorSkuIDList = append(vendorSkuIDList, v.VendorSkuID)
|
|
}
|
|
}
|
|
return vendorSkuIDList
|
|
}
|
|
|
|
func (l BareStoreSkuInfoList) GetVendorSkuIDIntList() (vendorSkuIDIntList []int64) {
|
|
for _, v := range l {
|
|
if !dao.IsVendorThingIDEmpty(v.VendorSkuID) {
|
|
vendorSkuIDIntList = append(vendorSkuIDIntList, utils.Str2Int64(v.VendorSkuID))
|
|
}
|
|
}
|
|
return vendorSkuIDIntList
|
|
}
|
|
|
|
func (l BareStoreSkuInfoList) GetSkuIDList() (skuIDList []int) {
|
|
for k, v := range l {
|
|
if v.SkuID > 0 {
|
|
skuIDList[k] = v.SkuID
|
|
}
|
|
}
|
|
return skuIDList
|
|
}
|
|
|
|
type BareCategoryInfo struct {
|
|
VendorCatID string `json:"vendorCatID"`
|
|
|
|
Level int `json:"level"`
|
|
Name string `json:"name"`
|
|
Seq int `json:"seq,omitempty"`
|
|
Children []*BareCategoryInfo `json:"children,omitempty"`
|
|
}
|
|
|
|
type IPurchasePlatformStoreSkuHandler interface {
|
|
GetStoreSkusBatchSize(funcID int) int
|
|
|
|
GetStoreSkusBareInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, inStoreSkuList []*StoreSkuInfo) (outStoreSkuList []*StoreSkuInfo, err error)
|
|
UpdateStoreSkusStock(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (err error)
|
|
UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (err error)
|
|
UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (err error)
|
|
}
|
|
|
|
type ISingleStoreStoreSkuHandler interface {
|
|
IPurchasePlatformStoreSkuHandler
|
|
|
|
GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, skuIDs []int) (outSkuNameList []*SkuNameInfo, err error)
|
|
CreateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (err error)
|
|
UpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (err error)
|
|
DeleteStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (err error)
|
|
|
|
GetStoreAllCategories(ctx *jxcontext.Context, storeID int, vendorStoreID string) (cats []*BareCategoryInfo, err error)
|
|
CreateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error)
|
|
UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error)
|
|
DeleteStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID, vendorCatID string) (err error)
|
|
}
|
|
|
|
func BuildSkuName(skuID int, vendorSkuID string) (skuName *SkuNameInfo) {
|
|
return &SkuNameInfo{
|
|
SkuList: []*SkuInfo{
|
|
&SkuInfo{
|
|
StoreSkuInfo: StoreSkuInfo{
|
|
SkuID: skuID,
|
|
VendorSkuID: vendorSkuID,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|