京东商城同步修改,关注可售修改
This commit is contained in:
@@ -1175,7 +1175,22 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
|
||||
return nil, err
|
||||
}
|
||||
} else if vendorID == model.VendorIDJDShop {
|
||||
storeMap.SyncStatus = model.SyncFlagNewMask //京东商城要去建店
|
||||
if storeMap.VendorStoreID == "" {
|
||||
storeMap.SyncStatus = model.SyncFlagNewMask //京东商城要去建店
|
||||
} else {
|
||||
if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil {
|
||||
store, err2 := handler.ReadStore(ctx, vendorOrgCode, storeMap.VendorStoreID)
|
||||
if err = err2; err == nil || storeMap.IsSync == 0 {
|
||||
if store != nil {
|
||||
storeMap.Status = store.Status
|
||||
}
|
||||
err = nil
|
||||
storeMap.SyncStatus = model.SyncFlagModifiedMask | model.SyncFlagStoreName | model.SyncFlagStoreAddress
|
||||
}
|
||||
} else {
|
||||
err = ErrCanNotFindVendor
|
||||
}
|
||||
}
|
||||
}
|
||||
storeMapList, err := dao.GetStoresMapList2(db, []int{vendorID}, []int{storeID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", true)
|
||||
if len(storeMapList) > 0 {
|
||||
|
||||
@@ -853,7 +853,7 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func UpdateStoresSkusByBind(ctx *jxcontext.Context, parentTask tasksch.ITask, skuBindInfos []*StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
func UpdateStoresSkusByBind(ctx *jxcontext.Context, parentTask tasksch.ITask, skuBindInfos []*StoreSkuBindInfo, isAsync, isContinueWhenError, isFos bool) (hint string, err error) {
|
||||
// if len(skuBindInfos) > maxStoreNameBind {
|
||||
// return "", fmt.Errorf("门店商品信息大于%d", maxStoreNameBind)
|
||||
// }
|
||||
@@ -892,7 +892,7 @@ func UpdateStoresSkusByBind(ctx *jxcontext.Context, parentTask tasksch.ITask, sk
|
||||
isAsync = asyncStoreSkuOpFilter(ctx, isAsync)
|
||||
if num > 0 {
|
||||
skuIDs := jxutils.IntMap2List(skuIDMap)
|
||||
hint, err = CurVendorSync.SyncStoresSkus(ctx, parentTask, 0, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError)
|
||||
hint, err = CurVendorSync.SyncStoresSkus(ctx, parentTask, 0, db, nil, storeIDs, skuIDs, isFos, isAsync, isContinueWhenError)
|
||||
}
|
||||
if num == 0 || !isAsync || hint == "" {
|
||||
hint = utils.Int64ToStr(num)
|
||||
@@ -3111,7 +3111,7 @@ func FocusStoreSkusByExcelBin(ctx *jxcontext.Context, reader io.Reader, isAsync,
|
||||
for _, v := range result1 {
|
||||
skuBindInfos = append(skuBindInfos, v.(*StoreSkuBindInfo))
|
||||
}
|
||||
UpdateStoresSkusByBind(ctx, task, skuBindInfos, true, true)
|
||||
UpdateStoresSkusByBind(ctx, task, skuBindInfos, true, true, false)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
@@ -3206,7 +3206,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuBindInfos []*StoreSkuBindInf
|
||||
for _, v := range result1 {
|
||||
skuBindInfos = append(skuBindInfos, v.(*StoreSkuBindInfo))
|
||||
}
|
||||
hint, err = UpdateStoresSkusByBind(ctx, task, skuBindInfos, isAsync, isContinueWhenError)
|
||||
hint, err = UpdateStoresSkusByBind(ctx, task, skuBindInfos, isAsync, isContinueWhenError, true)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
@@ -3302,7 +3302,7 @@ func AutoFocusStoreSkusForTopSkus(ctx *jxcontext.Context, isAsync, isContinueWhe
|
||||
for _, v := range result1 {
|
||||
skuBindInfos = append(skuBindInfos, v.(*StoreSkuBindInfo))
|
||||
}
|
||||
hint, err = UpdateStoresSkusByBind(ctx, nil, skuBindInfos, isAsync, isContinueWhenError)
|
||||
hint, err = UpdateStoresSkusByBind(ctx, nil, skuBindInfos, isAsync, isContinueWhenError, false)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
@@ -3797,7 +3797,7 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus,
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
_, err = UpdateStoresSkusByBind(ctx, nil, param, isAsync, isContinueWhenError)
|
||||
_, err = UpdateStoresSkusByBind(ctx, nil, param, isAsync, isContinueWhenError, false)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
@@ -3880,7 +3880,7 @@ func RefreshJxPriceByVendor2(ctx *jxcontext.Context, storeIDs []int, vendorID in
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
_, err = UpdateStoresSkusByBind(ctx, nil, param, isAsync, isContinueWhenError)
|
||||
_, err = UpdateStoresSkusByBind(ctx, nil, param, isAsync, isContinueWhenError, false)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
@@ -4132,7 +4132,7 @@ func CreateSkusAndFocusFromWx(ctx *jxcontext.Context, productInfo *jdapi.Product
|
||||
IsSale: 1,
|
||||
}
|
||||
skuBindInfos = append(skuBindInfos, skuBindInfo)
|
||||
_, err := UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true)
|
||||
_, err := UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false)
|
||||
if err != nil {
|
||||
err = nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user