1
This commit is contained in:
@@ -118,12 +118,16 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
|
||||
globals.SugarLogger.Debugf("CreateStoreCategory=====err := %v", err)
|
||||
if storeCat.CatSyncStatus&model.SyncFlagNewMask == 0 && p.IsErrCategoryNotExist(err) && storeCat.StoreCatName != "" { // 修改分类名,但分类不存在
|
||||
storeCat.CatSyncStatus |= model.SyncFlagNewMask
|
||||
skuCode, err := api.AddStoreCategoryInfo(&request.AlibabaWdkSkuCategoryAddRequest{Param: &domain.AlibabaWdkSkuCategoryAddCategoryDo{
|
||||
Code: utils.String2Pointer(utils.Int2Str(storeCat.StoreCatID)),
|
||||
Name: &storeCat.StoreCatName,
|
||||
ParentCode: utils.String2Pointer(utils.Int2Str(storeCat.ParentID)),
|
||||
Leaf: utils.Bool2Point(false),
|
||||
}})
|
||||
createCategory := &request.AlibabaWdkSkuCategoryAddRequest{Param: &domain.AlibabaWdkSkuCategoryAddCategoryDo{
|
||||
Code: utils.String2Pointer(utils.Int2Str(storeCat.StoreCatID)),
|
||||
Name: &storeCat.StoreCatName,
|
||||
Leaf: utils.Bool2Point(false),
|
||||
}}
|
||||
if storeCat.ParentID != model.NO {
|
||||
createCategory.Param.ParentCode = utils.String2Pointer(utils.Int2Str(storeCat.ParentID))
|
||||
}
|
||||
|
||||
skuCode, err := api.AddStoreCategoryInfo(createCategory)
|
||||
globals.SugarLogger.Debugf("AddStoreCategoryInfo=====err := %v", err)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -133,12 +137,17 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
|
||||
}
|
||||
// 创建分类
|
||||
if model.IsSyncStatusNeedCreate(storeCat.CatSyncStatus) {
|
||||
skuCode, err := api.AddStoreCategoryInfo(&request.AlibabaWdkSkuCategoryAddRequest{Param: &domain.AlibabaWdkSkuCategoryAddCategoryDo{
|
||||
Code: utils.String2Pointer(utils.Int2Str(storeCat.StoreCatID)),
|
||||
Name: &storeCat.StoreCatName,
|
||||
ParentCode: utils.String2Pointer(utils.Int2Str(storeCat.ParentID)),
|
||||
Leaf: utils.Bool2Point(false),
|
||||
}})
|
||||
createCategoryParam := &request.AlibabaWdkSkuCategoryAddRequest{Param: &domain.AlibabaWdkSkuCategoryAddCategoryDo{
|
||||
Code: utils.String2Pointer(utils.Int2Str(storeCat.StoreCatID)),
|
||||
Name: &storeCat.StoreCatName,
|
||||
Leaf: utils.Bool2Point(false),
|
||||
}}
|
||||
if storeCat.ParentID != model.NO {
|
||||
createCategoryParam.Param.ParentCode = utils.String2Pointer(utils.Int2Str(storeCat.ParentID))
|
||||
}
|
||||
|
||||
skuCode, err := api.AddStoreCategoryInfo(createCategoryParam)
|
||||
globals.SugarLogger.Debugf("IsSyncStatusNeedCreate AddStoreCategoryInfo : skucode : %s ,%v", utils.Format4Output(skuCode, false), err)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user