测试京东商城商品删除规格
This commit is contained in:
@@ -219,9 +219,16 @@ func FullSyncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo
|
||||
}
|
||||
|
||||
func isStoreSkuSyncNeedDelete(storeSku *dao.StoreSkuSyncInfo) bool {
|
||||
return model.IsSyncStatusDelete(storeSku.SkuSyncStatus) ||
|
||||
if model.IsSyncStatusDelete(storeSku.SkuSyncStatus) ||
|
||||
storeSku.BindDeletedAt != utils.DefaultTimeValue || storeSku.BindID == 0 ||
|
||||
storeSku.NameID == 0 || storeSku.NameStatus != model.SkuStatusNormal || storeSku.Status != model.SkuStatusNormal
|
||||
storeSku.NameID == 0 || storeSku.NameStatus != model.SkuStatusNormal {
|
||||
return true
|
||||
}
|
||||
if storeSku.Status != model.SkuStatusNormal {
|
||||
storeSku.IsDeletedBySku = true
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSkuInfo) {
|
||||
@@ -238,6 +245,7 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk
|
||||
JxUnitPrice: inSku.UnitPrice,
|
||||
VendorSkuID2: utils.Int64ToStr(inSku.JdsWareID),
|
||||
JdsStockSwitch: inSku.JdsStockSwitch,
|
||||
IsDeletedBySku: inSku.IsDeletedBySku,
|
||||
}
|
||||
if !isStoreSkuSyncNeedDelete(inSku) {
|
||||
outSku.Stock = model.MaxStoreSkuStockQty
|
||||
|
||||
@@ -53,6 +53,7 @@ type StoreSkuInfo struct {
|
||||
JxUnitPrice int64 `json:"jxUnitPrice,omitempty"`
|
||||
VendorSkuID2 string `json:"vendorSkuID2,omitempty"`
|
||||
JdsStockSwitch int `json:"jdsStockSwitch"`
|
||||
IsDeletedBySku bool `json:"isDeletedBySku"`
|
||||
}
|
||||
|
||||
type StoreSkuInfoWithErr struct {
|
||||
|
||||
@@ -200,14 +200,16 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
||||
func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite && vendorStoreID == model.JdShopMainVendorStoreID {
|
||||
for _, v := range storeSkuList {
|
||||
// err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID))
|
||||
err = api.JdShopAPI.UpOrDown(utils.Str2Int64(v.VendorSkuID2), 2)
|
||||
if err == nil {
|
||||
err = api.JdShopAPI.DeleteWare(utils.Str2Int(v.VendorSkuID2))
|
||||
if v.IsDeletedBySku {
|
||||
err = api.JdShopAPI.DeleteSku(utils.Str2Int64(v.VendorSkuID))
|
||||
} else {
|
||||
err = api.JdShopAPI.UpOrDown(utils.Str2Int64(v.VendorSkuID2), 2)
|
||||
if err == nil {
|
||||
err = api.JdShopAPI.DeleteWare(utils.Str2Int(v.VendorSkuID2))
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "删除商品")...)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user