京东商城店内分类修改
This commit is contained in:
@@ -335,7 +335,7 @@ func updateStoreSku(db *dao.DaoDB, vendorID int, storeSkuList []*dao.StoreSkuSyn
|
||||
// }
|
||||
// }()
|
||||
if vendorID == model.VendorIDJDShop {
|
||||
if syncStatus != model.SyncFlagPriceMask {
|
||||
if syncStatus != model.SyncFlagPriceMask && syncStatus != model.SyncFlagSaleMask {
|
||||
for _, v := range storeSkuList {
|
||||
updateItemList := make([]*dao.KVUpdateItem, len(v.StoreSkuSyncInfoJds))
|
||||
for k, vv := range v.StoreSkuSyncInfoJds {
|
||||
|
||||
@@ -68,10 +68,10 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
}
|
||||
err = api.JdShopAPI.UpdateEntityStore(updateEntityStoreParam)
|
||||
if err == nil {
|
||||
if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||
mergeStatus := jxutils.MergeStoreStatus(store.Status, store.VendorStatus)
|
||||
err = api.JdShopAPI.UpdateStoreStatus(utils.Str2Int(store.VendorStoreID), jxStatus2JdsStatus(mergeStatus))
|
||||
}
|
||||
// if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||
// mergeStatus := jxutils.MergeStoreStatus(store.Status, store.VendorStatus)
|
||||
// err = api.JdShopAPI.UpdateStoreStatus(utils.Str2Int(store.VendorStoreID), jxStatus2JdsStatus(mergeStatus))
|
||||
// }
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package jdshop
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -303,7 +304,10 @@ func (p *PurchaseHandler) GetStoreAllCategories(ctx *jxcontext.Context, storeID
|
||||
|
||||
func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
||||
if globals.EnableJdShopWrite && vendorStoreID == model.JdShopMainVendorStoreID {
|
||||
err = updateOrCreateCategories(storeCat, true)
|
||||
status, err := updateOrCreateCategories(storeCat, true)
|
||||
if status == -1 {
|
||||
return fmt.Errorf("京东商城店内分类创建失败!")
|
||||
}
|
||||
result, err := api.JdShopAPI.FindShopCategories()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -320,7 +324,11 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
||||
if globals.EnableJdShopWrite && vendorStoreID == model.JdShopMainVendorStoreID {
|
||||
err = updateOrCreateCategories(storeCat, false)
|
||||
status, err2 := updateOrCreateCategories(storeCat, false)
|
||||
err = err2
|
||||
if status == -1 {
|
||||
return fmt.Errorf("京东商城店内分类更新失败!")
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -383,11 +391,11 @@ func vendorSku2Jx(result *jdshopapi.SearchWare4ValidResultData) (skuName *partne
|
||||
return skuName
|
||||
}
|
||||
|
||||
func updateOrCreateCategories(storeCat *dao.SkuStoreCatInfo, isCreate bool) (err error) {
|
||||
func updateOrCreateCategories(storeCat *dao.SkuStoreCatInfo, isCreate bool) (status int64, err error) {
|
||||
var createShopCategoryParams []*jdshopapi.CreateShopCategoryParam
|
||||
result, err := api.JdShopAPI.FindShopCategories()
|
||||
if err != nil {
|
||||
return err
|
||||
return -1, err
|
||||
}
|
||||
for _, v := range result {
|
||||
createShopCategoryParam := &jdshopapi.CreateShopCategoryParam{
|
||||
@@ -410,7 +418,7 @@ func updateOrCreateCategories(storeCat *dao.SkuStoreCatInfo, isCreate bool) (err
|
||||
}
|
||||
if isCreate {
|
||||
createShopCategoryParam2.Type = jdshopapi.CreateCatType
|
||||
createShopCategoryParam2.ID = "0"
|
||||
createShopCategoryParam2.ID = "1"
|
||||
createShopCategoryParams = append(createShopCategoryParams, createShopCategoryParam2)
|
||||
} else {
|
||||
for _, v := range createShopCategoryParams {
|
||||
@@ -420,8 +428,8 @@ func updateOrCreateCategories(storeCat *dao.SkuStoreCatInfo, isCreate bool) (err
|
||||
}
|
||||
}
|
||||
}
|
||||
err = api.JdShopAPI.CreateShopCategory(createShopCategoryParams)
|
||||
return err
|
||||
status, err = api.JdShopAPI.CreateShopCategory(createShopCategoryParams)
|
||||
return status, err
|
||||
}
|
||||
|
||||
func buildCreateWareParam(storeSku *dao.StoreSkuSyncInfo) (createSkuParamWare *jdshopapi.CreateSkuParamWare, createSkuParamSkus []*jdshopapi.CreateSkuParamSkus, err error) {
|
||||
|
||||
Reference in New Issue
Block a user