京东修改分类名忽略没有实际修改错(即当前的与要修改的一样)
This commit is contained in:
@@ -340,9 +340,16 @@ func (a *API) UpdateShopCategory(id int64, shopCategoryName string) error {
|
||||
KeyShopCategoryName: shopCategoryName,
|
||||
}
|
||||
_, err := a.AccessAPINoPage("pms/updateShopCategory", params, nil, nil, nullResultParser)
|
||||
if IsErrIgnorable(err) {
|
||||
err = nil
|
||||
}
|
||||
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
|
||||
func (a *API) ChangeShopCategoryOrder(pid int64, childIds []int64) error {
|
||||
|
||||
@@ -60,19 +60,32 @@ func TestBatchUpdateOutSkuId(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQuerySkuInfos(t *testing.T) {
|
||||
pageSize := 20
|
||||
result, totalCount, err := api.QuerySkuInfos(&QuerySkuParam{
|
||||
IsFilterDel: IsFilterDelTrue,
|
||||
})
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
t.Log(totalCount)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
pageSize := MaxSkuIDsCount4QueryListBySkuIds
|
||||
pageNo := 1
|
||||
var skuList []*SkuMain
|
||||
for {
|
||||
result, totalCount, err := api.QuerySkuInfos(&QuerySkuParam{
|
||||
PageSize: pageSize,
|
||||
PageNo: pageNo,
|
||||
IsFilterDel: IsFilterDelTrue,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
skuList = append(skuList, result...)
|
||||
if len(skuList) >= totalCount {
|
||||
break
|
||||
}
|
||||
pageNo++
|
||||
}
|
||||
if len(result) != pageSize || totalCount == 0 {
|
||||
baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
||||
t.Fatalf("QuerySkuInfos result size is not same as requested:%d", pageSize)
|
||||
var abnormalSkuList []*SkuMain
|
||||
for _, v := range skuList {
|
||||
if len(v.ShopCategories) == 0 {
|
||||
abnormalSkuList = append(abnormalSkuList, v)
|
||||
}
|
||||
}
|
||||
t.Log(utils.Format4Output(abnormalSkuList, false))
|
||||
t.Log(len(abnormalSkuList))
|
||||
}
|
||||
|
||||
func TestQueryListBySkuIds(t *testing.T) {
|
||||
@@ -240,3 +253,10 @@ func TestUpdateSku(t *testing.T) {
|
||||
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