+FullSyncVendorStuff

This commit is contained in:
gazebo
2019-12-11 22:30:32 +08:00
parent 2156c77dbf
commit db85de7454
8 changed files with 263 additions and 41 deletions

View File

@@ -163,7 +163,7 @@ type IMultipleStoresHandler interface {
CreateCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error)
UpdateCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error)
DeleteCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error)
DeleteCategory2(ctx *jxcontext.Context, vendorOrgCode, vendorCatID string) (err error)
ReorderCategories2(ctx *jxcontext.Context, vendorOrgCode, vendorParentCatID string, vendorCatIDList []string) (err error)
// sku
@@ -174,7 +174,7 @@ type IMultipleStoresHandler interface {
// ReadSku(ctx *jxcontext.Context, vendorOrgCode, vendorSkuID string) (skuNameExt *model.SkuNameExt, err error)
CreateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error)
UpdateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error)
DeleteSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error)
DeleteSku2(ctx *jxcontext.Context, vendorOrgCode string, sku *StoreSkuInfo) (err error)
// RefreshAllSkusID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error)

View File

@@ -70,6 +70,7 @@ func (p *PurchaseHandler) GetAllCategories(ctx *jxcontext.Context, vendorOrgCode
}
func (p *PurchaseHandler) CreateCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error) {
globals.SugarLogger.Debugf("CreateCategory2 cat:%s", utils.Format4Output(cat, true))
if globals.EnableJdStoreWrite {
result, err2 := getAPI(cat.VendorOrgCode).AddShopCategory(utils.Str2Int64(cat.ParentVendorCatID), cat.Name, int(cat.Level), cat.Seq, ctx.GetUserName())
if err = err2; err == nil {
@@ -84,15 +85,17 @@ func (p *PurchaseHandler) CreateCategory2(ctx *jxcontext.Context, cat *dao.SkuSt
}
func (p *PurchaseHandler) UpdateCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error) {
globals.SugarLogger.Debugf("UpdateCategory2 cat:%s", utils.Format4Output(cat, true))
if globals.EnableJdStoreWrite {
err = getAPI(cat.VendorOrgCode).UpdateShopCategory(utils.Str2Int64(cat.VendorCatID), cat.Name)
}
return err
}
func (p *PurchaseHandler) DeleteCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error) {
func (p *PurchaseHandler) DeleteCategory2(ctx *jxcontext.Context, vendorOrgCode, vendorCatID string) (err error) {
globals.SugarLogger.Debugf("DeleteCategory2 vendorOrgCode:%s, vendorCatID:%s", vendorOrgCode, vendorCatID)
if globals.EnableJdStoreWrite {
err = getAPI(cat.VendorOrgCode).DelShopCategory(utils.Str2Int64(cat.VendorCatID))
err = getAPI(vendorOrgCode).DelShopCategory(utils.Str2Int64(vendorCatID))
}
return err
}
@@ -171,6 +174,7 @@ func skuInfo2Param(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (param *jd
}
func (p *PurchaseHandler) CreateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error) {
globals.SugarLogger.Debugf("CreateSku2 sku:%s", utils.Format4Output(sku, true))
param := skuInfo2Param(ctx, sku)
if globals.EnableJdStoreWrite {
sku.VendorSkuID, err = getAPI(sku.VendorOrgCode).AddSku2(param)
@@ -181,6 +185,7 @@ func (p *PurchaseHandler) CreateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSy
}
func (p *PurchaseHandler) UpdateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error) {
globals.SugarLogger.Debugf("UpdateSku2 sku:%s", utils.Format4Output(sku, true))
param := skuInfo2Param(ctx, sku)
if globals.EnableJdStoreWrite {
_, err = getAPI(sku.VendorOrgCode).UpdateSku2(param)
@@ -188,14 +193,15 @@ func (p *PurchaseHandler) UpdateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSy
return err
}
func (p *PurchaseHandler) DeleteSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error) {
func (p *PurchaseHandler) DeleteSku2(ctx *jxcontext.Context, vendorOrgCode string, sku *partner.StoreSkuInfo) (err error) {
globals.SugarLogger.Debugf("DeleteSku2 vendorOrgCode:%s, sku:%s", vendorOrgCode, utils.Format4Output(sku, true))
param := &jdapi.OpSkuParam{
TraceID: ctx.GetTrackInfo(),
OutSkuID: utils.Int2Str(sku.SkuID),
FixedStatus: jdapi.SkuFixedStatusDeleted,
}
if globals.EnableJdStoreWrite {
_, err = getAPI(sku.VendorOrgCode).UpdateSku2(param)
_, err = getAPI(vendorOrgCode).UpdateSku2(param)
}
return err
}

View File

@@ -37,7 +37,7 @@ func (p *PurchaseHandler) UpdateCategory2(ctx *jxcontext.Context, cat *dao.SkuSt
return err
}
func (p *PurchaseHandler) DeleteCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error) {
func (p *PurchaseHandler) DeleteCategory2(ctx *jxcontext.Context, vendorOrgCode, vendorCatID string) (err error) {
return err
}
@@ -69,7 +69,7 @@ func (p *PurchaseHandler) UpdateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSy
return err
}
func (p *PurchaseHandler) DeleteSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error) {
func (p *PurchaseHandler) DeleteSku2(ctx *jxcontext.Context, vendorOrgCode string, sku *partner.StoreSkuInfo) (err error) {
return err
}