diff --git a/platformapi/jdshopapi/jdshopapi.go b/platformapi/jdshopapi/jdshopapi.go index 39c91896..780d4b62 100644 --- a/platformapi/jdshopapi/jdshopapi.go +++ b/platformapi/jdshopapi/jdshopapi.go @@ -33,6 +33,21 @@ const ( JxBrandId = 559853 JdShopMaxStock = 9999 JdsPromiseID = 13725637 + + JdsSkuStatus1 = 1 //从未上架 + JdsSkuStatus2 = 2 //自主下架 + JdsSkuStatus4 = 4 //系统下架 + JdsSkuStatus8 = 8 //在售 + JdsSkuStatus513 = 513 //从未上架 待审核 + JdsSkuStatus514 = 514 //自主下架 待审核 + JdsSkuStatus516 = 516 //系统下架 待审核 + JdsSkuStatus520 = 520 //在售 待审核 + JdsSkuStatus1025 = 1025 //从未上架 审核不通过 暂时没用 + JdsSkuStatus1026 = 1026 //自主下架 审核不通过 暂时没用 + JdsSkuStatus1028 = 1028 //系统下架 审核不通过 + JdsSkuStatus1032 = 1032 //在售 审核不通过 + + PassReason = "审核通过" ) var ( diff --git a/platformapi/jdshopapi/sku.go b/platformapi/jdshopapi/sku.go index a6aa75f8..47bbfc4e 100644 --- a/platformapi/jdshopapi/sku.go +++ b/platformapi/jdshopapi/sku.go @@ -548,9 +548,12 @@ func (a *API) UpdateWareMarketPrice(wareId int64, marketPrice float64) (err erro //获取商品下架原因 //https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1225&apiName=jingdong.ware.read.findOpReason -func (a *API) FindOpReason(wareId int64) (err error) { - _, err = a.AccessAPI2("jingdong.ware.read.findOpReason", prodURL, map[string]interface{}{ +func (a *API) FindOpReason(wareId int64) (reason string, err error) { + result, err := a.AccessAPI2("jingdong.ware.read.findOpReason", prodURL, map[string]interface{}{ "wareId": wareId, }) - return err + if err == nil { + reason = result["jingdong_ware_read_findOpReason_responce"].(map[string]interface{})["opReason"].(map[string]interface{})["note"].(string) + } + return reason, err } diff --git a/platformapi/jdshopapi/sku_test.go b/platformapi/jdshopapi/sku_test.go index 58280472..abbec81d 100644 --- a/platformapi/jdshopapi/sku_test.go +++ b/platformapi/jdshopapi/sku_test.go @@ -378,9 +378,9 @@ func TestUpdateWareMarketPrice(t *testing.T) { } func TestFindOpReason(t *testing.T) { - err := api.FindOpReason(14519009105) + result, err := api.FindOpReason(14519009105) if err != nil { t.Fatal(err) } - // t.Log(utils.Format4Output(result, false)) + t.Log(utils.Format4Output(result, false)) } diff --git a/platformapi/jdshopapi/store_page.go b/platformapi/jdshopapi/store_page.go index 73d043a0..db7959c0 100644 --- a/platformapi/jdshopapi/store_page.go +++ b/platformapi/jdshopapi/store_page.go @@ -32,6 +32,9 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{}, if jsonResult1 == nil { return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil") } + if strings.Contains(bodyStr, "登录") { + return platformapi.ErrLevelRecoverableErr, fmt.Errorf("cookie可能过期了!") + } if err == nil { if jsonResult1["error_response"] != nil { errLevel = platformapi.ErrLevelGeneralFail