银豹变更商品状态

This commit is contained in:
苏尹岚
2020-07-01 17:26:28 +08:00
parent 1957696d84
commit b853dbb954
3 changed files with 25 additions and 2 deletions

View File

@@ -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
}

View File

@@ -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))
}

View File

@@ -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)