- add conf enableJdStoreWrite
- enable enableEbaiStoreWrite on beta
This commit is contained in:
@@ -59,7 +59,7 @@ func (p *PurchaseHandler) CreateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
params["category1"] = ""
|
||||
params["category2"] = ""
|
||||
params["category3"] = ""
|
||||
if globals.EnableStoreWrite && globals.EnableEbaiStoreWrite {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
intVendorStoreID, err2 := api.EbaiAPI.ShopCreate(params)
|
||||
if err = err2; err == nil {
|
||||
return utils.Int64ToStr(intVendorStoreID), err
|
||||
@@ -160,7 +160,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
if err = dao.GetRows(db, &stores, sql, model.VendorIDEBAI, utils.DefaultTimeValue, storeID); err == nil {
|
||||
for _, store := range stores {
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
||||
if globals.EnableStoreWrite && globals.EnableEbaiStoreWrite {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
shopID := 0
|
||||
if store.SyncStatus&model.SyncFlagDeletedMask == 0 {
|
||||
shopID = store.ID
|
||||
@@ -248,7 +248,7 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
||||
shopIDs[k] = utils.GetUUID()
|
||||
}
|
||||
}
|
||||
if globals.EnableStoreWrite && globals.EnableEbaiStoreWrite {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
err = api.EbaiAPI.ShopIDBatchUpdate(baiduShopIDs, shopIDs)
|
||||
}
|
||||
return nil, err
|
||||
|
||||
@@ -248,7 +248,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
storeSku := batchItemList[0].(*tStoreSkuFullInfo)
|
||||
updateFields := []string{model.FieldEbaiSyncStatus}
|
||||
if globals.EnableStoreWrite && globals.EnableEbaiStoreWrite {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if storeSku.SkuID == 0 || storeSku.EbaiSyncStatus&model.SyncFlagDeletedMask != 0 {
|
||||
if storeSku.EbaiSyncStatus&model.SyncFlagNewMask == 0 && storeSku.EbaiID != 0 {
|
||||
err = api.EbaiAPI.SkuDelete(strStoreID, utils.Int64ToStr(storeSku.EbaiID))
|
||||
@@ -344,7 +344,7 @@ func (p *PurchaseHandler) DeleteRemoteSkus(ctx *jxcontext.Context, parentTask ta
|
||||
for k, v := range batchItemList {
|
||||
strList[k] = v.(string)
|
||||
}
|
||||
if globals.EnableStoreWrite && globals.EnableEbaiStoreWrite {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
err = api.EbaiAPI.SkuDelete(utils.Int2Str(storeID), strings.Join(strList, ","))
|
||||
}
|
||||
return nil, err
|
||||
@@ -369,7 +369,7 @@ func (p *PurchaseHandler) DeleteRemoteCategories(ctx *jxcontext.Context, parentT
|
||||
}
|
||||
task := tasksch.NewParallelTask("DeleteRemoteCategories", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
if globals.EnableStoreWrite && globals.EnableEbaiStoreWrite {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
err = api.EbaiAPI.ShopCategoryDelete(strStoreID, batchItemList[0].(int64))
|
||||
}
|
||||
return nil, err
|
||||
@@ -516,7 +516,7 @@ func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask t
|
||||
updateFields := []string{model.FieldEbaiSyncStatus}
|
||||
catInfo := batchItemList[0].(*tStoreCatInfo)
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(catInfo, false))
|
||||
if globals.EnableStoreWrite && globals.EnableEbaiStoreWrite {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if catInfo.EbaiSyncStatus&model.SyncFlagDeletedMask != 0 { // 删除
|
||||
if catInfo.EbaiSyncStatus&model.SyncFlagNewMask == 0 && catInfo.EbaiID != 0 {
|
||||
err = api.EbaiAPI.ShopCategoryDelete(strStoreID, catInfo.EbaiID)
|
||||
|
||||
@@ -147,7 +147,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
}
|
||||
_, params["closeStatus"] = JxStoreStatus2JdStatus(jxutils.MergeStoreStatus(store.Status, store.JdStoreStatus))
|
||||
globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
||||
if globals.EnableStoreWrite {
|
||||
if globals.EnableJdStoreWrite {
|
||||
if err = api.JdAPI.UpdateStoreInfo4Open(store.VendorStoreID, store.RealLastOperator, params); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -238,7 +238,7 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
||||
if step != stepCount-1 {
|
||||
storeParams["outSystemId"] = utils.GetUUID()
|
||||
}
|
||||
if true { //globals.EnableStoreWrite {
|
||||
if globals.EnableJdStoreWrite {
|
||||
err = api.JdAPI.UpdateStoreInfo4Open(store.VendorStoreID, ctx.GetUserName(), storeParams)
|
||||
}
|
||||
return nil, err
|
||||
|
||||
@@ -108,7 +108,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
}
|
||||
syncMask := 0
|
||||
errList := []error{}
|
||||
if globals.EnableStoreWrite {
|
||||
if globals.EnableJdStoreWrite {
|
||||
// todo 以下可以优化为并行操作
|
||||
globals.SugarLogger.Debug(utils.Format4Output(skuVendibilityList, false), utils.Format4Output(skuPriceInfoList, false), utils.Format4Output(skuStockList, false))
|
||||
if len(skuVendibilityList) > 0 {
|
||||
@@ -239,7 +239,7 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("jd syncStoreSkus sync detail, storeID:%d, skuVendibilityList:%s, skuPriceInfoList:%s, skuStockList:%s", storeID, utils.Format4Output(skuVendibilityList, true), utils.Format4Output(skuPriceInfoList, true), utils.Format4Output(skuStockList, true))
|
||||
if globals.EnableStoreWrite {
|
||||
if globals.EnableJdStoreWrite {
|
||||
// todo 以下可以优化为并行操作
|
||||
if len(skuVendibilityList) > 0 {
|
||||
_, err = api.JdAPI.BatchUpdateVendibility("", stationNo, skuVendibilityList, ctx.GetUserName())
|
||||
|
||||
@@ -35,7 +35,7 @@ func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask t
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
updateFields := []string{dao.GetSyncStatusStructField(model.VendorNames[model.VendorIDMTWM])}
|
||||
catInfo := batchItemList[0].(*dao.StoreCatSyncInfo)
|
||||
if globals.EnableStoreWrite && globals.EnableMtwmStoreWrite {
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
if catInfo.MtwmSyncStatus&model.SyncFlagDeletedMask != 0 { // 删除
|
||||
if catInfo.MtwmSyncStatus&model.SyncFlagNewMask == 0 && catInfo.MtwmID != "" {
|
||||
globals.SugarLogger.Debugf("RetailCatDelete vendorStoreID:%s, MtwmID:%s", vendorStoreID, catInfo.MtwmID)
|
||||
@@ -129,7 +129,7 @@ func (p *PurchaseHandler) SyncLocalStoreCategory(ctx *jxcontext.Context, db *dao
|
||||
localCat := catMap[level-1][parentCatName+"/"+catName]
|
||||
// globals.SugarLogger.Debug(parentCatName, " ", catName, " ", localCat)
|
||||
if localCat == nil { // 本地分类就没有这个名字,直接删除
|
||||
if globals.EnableStoreWrite && globals.EnableMtwmStoreWrite {
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
globals.SugarLogger.Debugf("RetailCatDelete2 vendorStoreID:%s, catName:%s", vendorStoreID, catName)
|
||||
if err = api.MtwmAPI.RetailCatDelete(vendorStoreID, catName); err != nil {
|
||||
return err
|
||||
@@ -292,7 +292,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
skus[0]["weight"] = skuItem.Weight // weight字段仅限服饰鞋帽、美妆、日用品、母婴、生鲜果蔬、生活超市下的便利店/超市门店品类的商家使用
|
||||
}
|
||||
foodData["skus"] = skus
|
||||
if globals.EnableStoreWrite && globals.EnableMtwmStoreWrite {
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
if err = api.MtwmAPI.RetailBatchInitData(vendorStoreID, foodDataList); err == nil {
|
||||
storeSkuBind.MtwmID = int64(skuItem.ID)
|
||||
updateFields = append(updateFields, model.FieldMtwmID)
|
||||
@@ -373,7 +373,7 @@ func (p *PurchaseHandler) DeleteRemoteSkus(ctx *jxcontext.Context, parentTask ta
|
||||
vendorStoreID := storeDetail.VendorStoreID
|
||||
task := tasksch.NewParallelTask("mtwm DeleteRemoteSkus", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
if globals.EnableStoreWrite && globals.EnableMtwmStoreWrite {
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
// globals.SugarLogger.Debugf("mtwm RetailDelete vendorStoreID:%s, sku:%s", vendorStoreID, batchItemList[0].(string))
|
||||
err = api.MtwmAPI.RetailDelete(vendorStoreID, batchItemList[0].(string))
|
||||
}
|
||||
@@ -434,7 +434,7 @@ func (p *PurchaseHandler) DeleteRemoteCategories(ctx *jxcontext.Context, parentT
|
||||
if len(catIDs) > 0 {
|
||||
task := tasksch.NewParallelTask("mtwm DeleteRemoteCategories paralle", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
if globals.EnableStoreWrite && globals.EnableMtwmStoreWrite {
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
err = api.MtwmAPI.RetailCatDelete(vendorStoreID, batchItemList[0].(string))
|
||||
}
|
||||
return nil, err
|
||||
|
||||
@@ -38,7 +38,7 @@ func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask t
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
updateFields := []string{dao.GetSyncStatusStructField(model.VendorNames[model.VendorIDWSC])}
|
||||
catInfo := batchItemList[0].(*dao.StoreCatSyncInfo)
|
||||
if globals.EnableStoreWrite && globals.EnableWscStoreWrite {
|
||||
if globals.EnableWscStoreWrite {
|
||||
if catInfo.WscSyncStatus&model.SyncFlagDeletedMask != 0 { // 删除
|
||||
if catInfo.WscSyncStatus&model.SyncFlagNewMask == 0 {
|
||||
globals.SugarLogger.Debugf("UpdateClassify strStoreID:%s, WscID:%d", strStoreID, catInfo.WscID)
|
||||
@@ -222,7 +222,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
},
|
||||
},
|
||||
}
|
||||
if globals.EnableStoreWrite && globals.EnableWscStoreWrite {
|
||||
if globals.EnableWscStoreWrite {
|
||||
if skuItem.SkuSyncStatus&model.SyncFlagNewMask != 0 {
|
||||
goodsID, skuMap, err2 := api.WeimobAPI.AddGoods(outerGoodsCode, title, false, []string{skuItem.Img}, skuItem.Comment, isPutAway, 0, categoryId, classifyIdList, b2cGoods, skuList, nil)
|
||||
if err = err2; err == nil {
|
||||
|
||||
Reference in New Issue
Block a user