京东修改分类名忽略没有实际修改错(即当前的与要修改的一样)
This commit is contained in:
@@ -340,9 +340,16 @@ func (a *API) UpdateShopCategory(id int64, shopCategoryName string) error {
|
|||||||
KeyShopCategoryName: shopCategoryName,
|
KeyShopCategoryName: shopCategoryName,
|
||||||
}
|
}
|
||||||
_, err := a.AccessAPINoPage("pms/updateShopCategory", params, nil, nil, nullResultParser)
|
_, err := a.AccessAPINoPage("pms/updateShopCategory", params, nil, nil, nullResultParser)
|
||||||
|
if IsErrIgnorable(err) {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsErrIgnorable(err error) bool {
|
||||||
|
return err == nil || utils.IsErrMatch(err, "-3", []string{"店内分类名称未修改,无需操作"})
|
||||||
|
}
|
||||||
|
|
||||||
// 修改商家店内分类顺序接口
|
// 修改商家店内分类顺序接口
|
||||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=180&apiid=2a8267602e814be9828f0c7ce307b872
|
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=180&apiid=2a8267602e814be9828f0c7ce307b872
|
||||||
func (a *API) ChangeShopCategoryOrder(pid int64, childIds []int64) error {
|
func (a *API) ChangeShopCategoryOrder(pid int64, childIds []int64) error {
|
||||||
|
|||||||
@@ -60,19 +60,32 @@ func TestBatchUpdateOutSkuId(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestQuerySkuInfos(t *testing.T) {
|
func TestQuerySkuInfos(t *testing.T) {
|
||||||
pageSize := 20
|
pageSize := MaxSkuIDsCount4QueryListBySkuIds
|
||||||
result, totalCount, err := api.QuerySkuInfos(&QuerySkuParam{
|
pageNo := 1
|
||||||
IsFilterDel: IsFilterDelTrue,
|
var skuList []*SkuMain
|
||||||
})
|
for {
|
||||||
t.Log(utils.Format4Output(result, false))
|
result, totalCount, err := api.QuerySkuInfos(&QuerySkuParam{
|
||||||
t.Log(totalCount)
|
PageSize: pageSize,
|
||||||
if err != nil {
|
PageNo: pageNo,
|
||||||
t.Fatal(err)
|
IsFilterDel: IsFilterDelTrue,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
skuList = append(skuList, result...)
|
||||||
|
if len(skuList) >= totalCount {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
pageNo++
|
||||||
}
|
}
|
||||||
if len(result) != pageSize || totalCount == 0 {
|
var abnormalSkuList []*SkuMain
|
||||||
baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
for _, v := range skuList {
|
||||||
t.Fatalf("QuerySkuInfos result size is not same as requested:%d", pageSize)
|
if len(v.ShopCategories) == 0 {
|
||||||
|
abnormalSkuList = append(abnormalSkuList, v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
t.Log(utils.Format4Output(abnormalSkuList, false))
|
||||||
|
t.Log(len(abnormalSkuList))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQueryListBySkuIds(t *testing.T) {
|
func TestQueryListBySkuIds(t *testing.T) {
|
||||||
@@ -240,3 +253,10 @@ func TestUpdateSku(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUpdateShopCategory(t *testing.T) {
|
||||||
|
err := api.UpdateShopCategory(4760208, "中秋必抢🍳")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user