修改门店
This commit is contained in:
@@ -11,13 +11,18 @@ import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{}) (retVal map[string]interface{}, err error) {
|
||||
func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{}, isPost bool) (retVal map[string]interface{}, err error) {
|
||||
if a.GetCookieCount() == 0 {
|
||||
return nil, fmt.Errorf("需要设置Store Cookie才能使用此方法")
|
||||
}
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||
func() *http.Request {
|
||||
request, _ := http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(bizParams).Encode()))
|
||||
var request *http.Request
|
||||
if isPost {
|
||||
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(bizParams).Encode()))
|
||||
} else {
|
||||
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil)
|
||||
}
|
||||
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
a.FillRequestCookies(request)
|
||||
return request
|
||||
@@ -56,6 +61,16 @@ func (a *API) CreateShopCategory(createShopCategoryParam []*CreateShopCategoryPa
|
||||
result, _ := json.MarshalIndent(createShopCategoryParam, "", "")
|
||||
_, err = a.AccessStorePage("https://seller.shop.jd.com/vendershop/vendershop_doShopCategory.action", map[string]interface{}{
|
||||
"categoryJson": string(result),
|
||||
})
|
||||
}, true)
|
||||
return err
|
||||
}
|
||||
|
||||
//京东商城设置门店营业状态
|
||||
//https://stores.shop.jd.com/stores/updateStoreStatus?storeId=24330156&storeStatus=6
|
||||
func (a *API) UpdateStoreStatus(storeID, storeStatus int) (err error) {
|
||||
_, err = a.AccessStorePage("https://stores.shop.jd.com/stores/updateStoreStatus", map[string]interface{}{
|
||||
"storeId": storeID,
|
||||
"storeStatus": storeStatus,
|
||||
}, false)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user