From b853dbb95447c17099e83df236889982f215c9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 1 Jul 2020 17:26:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=B6=E8=B1=B9=E5=8F=98=E6=9B=B4=E5=95=86?= =?UTF-8?q?=E5=93=81=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/yinbaoapi/store_page.go | 15 +++++++++++++++ platformapi/yinbaoapi/store_page_test.go | 8 ++++++++ platformapi/yinbaoapi/yinbaoapi_test.go | 4 ++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/platformapi/yinbaoapi/store_page.go b/platformapi/yinbaoapi/store_page.go index 26cec933..44c945a7 100644 --- a/platformapi/yinbaoapi/store_page.go +++ b/platformapi/yinbaoapi/store_page.go @@ -539,3 +539,18 @@ func (a *API) TryGetCookie() (cookie string, err error) { }) return cookie, err } + +//银豹改变商品状态? +//https://beta27.pospal.cn/Product/BatchUpdateProductEnable +func (a *API) BatchUpdateProductEnable(userID, productId string, enable int) (err error) { + _, err = a.AccessStorePage("Product/BatchUpdateProductEnable", map[string]interface{}{ + "enable": enable, + "productRange[userId]": userID, + "productRange[enable]": enable, + "productRange[isProductRequestedStore]": false, + "productRange[isAddvancedSearch]": false, + "productRange[isUpdateAllProduct]": false, + "productRange[productUidsJson]": []string{productId}, + }) + return err +} diff --git a/platformapi/yinbaoapi/store_page_test.go b/platformapi/yinbaoapi/store_page_test.go index f9c0312e..198d6826 100644 --- a/platformapi/yinbaoapi/store_page_test.go +++ b/platformapi/yinbaoapi/store_page_test.go @@ -113,3 +113,11 @@ func DownloadFileByURL(fileURL string) (bodyData []byte, fileMD5 string, err err } return bodyData, fileMD5, err } + +func TestBatchUpdateProductEnable(t *testing.T) { + err := api.BatchUpdateProductEnable("3936087", "463072974624941184", 1) + if err != nil { + t.Fatal(err) + } + // t.Log(utils.Format4Output(result, false)) +} diff --git a/platformapi/yinbaoapi/yinbaoapi_test.go b/platformapi/yinbaoapi/yinbaoapi_test.go index 0f941ae1..11f3efb0 100644 --- a/platformapi/yinbaoapi/yinbaoapi_test.go +++ b/platformapi/yinbaoapi/yinbaoapi_test.go @@ -18,7 +18,7 @@ func init() { sugarLogger = logger.Sugar() baseapi.Init(sugarLogger) api = New("1131812849010800342", "1F42E107A9A6B6B91B064B0B9D1147A1") //总店 - api.SetCookie(".POSPALAUTH30220", "0102A5F8291F691DD808FEA560EE80711DD808000833003900330036003000380037003A0000012F00FF7C8E026CA3DD2B6D2E5369FB1BBEEE8C3B9BE392") + api.SetCookie(".POSPALAUTH30220", "01022774A1129E1DD808FE27DC6574A61DD808000833003900330036003000380037003A0000012F00FF70654DF44FCE339A45E682CD9ECC45C91C7A11AA") } func TestAddProductInfo(t *testing.T) { @@ -86,7 +86,7 @@ func TestQueryProductImagesByBarcode(t *testing.T) { func TestQueryProductPages(t *testing.T) { result, err := api.QueryProductPages(&PostBackParameter{ ParameterType: "LAST_RESULT_MAX_ID", - ParameterValue: "7064573", + ParameterValue: "13672479", }) if err != nil { t.Fatal(err)