- 重构partner_store_sku

This commit is contained in:
gazebo
2019-07-13 10:37:08 +08:00
parent cde87bb667
commit 01c522b5b0
9 changed files with 102 additions and 68 deletions

View File

@@ -14,13 +14,13 @@ import (
func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) {
switch funcID {
case partner.FuncUpdateStoreSkusStock, partner.FuncUpdateStoreSkusStatus, partner.FuncUpdateStoreSkusPrice:
case partner.FuncGetStoreSkusBareInfo, partner.FuncUpdateStoreSkusStock, partner.FuncUpdateStoreSkusStatus, partner.FuncUpdateStoreSkusPrice:
batchSize = jdapi.MaxStoreSkuBatchSize
}
return batchSize
}
func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, inStoreSkuList []*partner.BareStoreSkuInfo) (outStoreSkuList []*partner.BareStoreSkuInfo, err error) {
func (p *PurchaseHandler) GetStoreSkusBareInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, inStoreSkuList []*partner.StoreSkuInfo) (outStoreSkuList []*partner.StoreSkuInfo, err error) {
var batchSkuInfoList []*jdapi.BaseStockCenterRequest
batchSkuList := partner.BareStoreSkuInfoList(inStoreSkuList).GetVendorSkuIDIntList()
for _, v := range inStoreSkuList {
@@ -48,7 +48,7 @@ func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask ta
tasksch.HandleTask(task, parentTask, false).Run()
_, err = task.GetResult(0)
if err == nil {
storeSkuMap := make(map[int64]*partner.BareStoreSkuInfo)
storeSkuMap := make(map[int64]*partner.StoreSkuInfo)
for _, v := range inStoreSkuList {
storeSkuMap[utils.Str2Int64(v.VendorSkuID)] = v
}
@@ -77,7 +77,7 @@ func jxStoreSkuStatus2Jd(jxStoreSkuStatus int) (isSale bool) {
return jxStoreSkuStatus == model.SkuStatusNormal
}
func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.BareStoreSkuInfo) (err error) {
func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (err error) {
var skuVendibilityList []*jdapi.StockVendibility
for _, v := range storeSkuList {
skuVendibilityList = append(skuVendibilityList, &jdapi.StockVendibility{
@@ -91,7 +91,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID
return err
}
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.BareStoreSkuInfo) (err error) {
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (err error) {
var skuPriceInfoList []*jdapi.SkuPriceInfo
for _, v := range storeSkuList {
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
@@ -105,7 +105,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID i
return err
}
func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.BareStoreSkuInfo) (err error) {
func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (err error) {
var skuStockList []*jdapi.SkuStock
for _, v := range storeSkuList {
skuStockList = append(skuStockList, &jdapi.SkuStock{