This commit is contained in:
suyl
2021-06-22 13:39:06 +08:00
parent bea35fdf85
commit 53e74f914a
2 changed files with 9 additions and 2 deletions

View File

@@ -37,6 +37,8 @@ const (
OrderStatusFinishedPickup = 51 //待配送
OrderStatusNew = 50 //待接单,已支付
OrderStatusCancelm2 = -2 //(删除)待配送
categoryURL = "https://seller.shop.jd.com/vendershop/vendershop_doShopCategory.action"
)
func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{}, isPost bool) (retVal map[string]interface{}, err error) {
@@ -49,6 +51,11 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{},
if isPost {
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(bizParams).Encode()))
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
if fullURL == categoryURL {
request.Header.Set("origin", "https://seller.shop.jd.com")
request.Header.Set("referer", "https://seller.shop.jd.com/vendershop/vendershop_shopCategory.action")
request.Header.Set("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36")
}
} else {
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil)
}
@@ -223,7 +230,7 @@ type CreateShopCategoryParam struct {
//https://seller.shop.jd.com/vendershop/vendershop_shopCategory.action#
func (a *API) CreateShopCategory(createShopCategoryParam []*CreateShopCategoryParam) (status int64, err error) {
data, _ := json.MarshalIndent(createShopCategoryParam, "", "")
result, err := a.AccessStorePage("https://seller.shop.jd.com/vendershop/vendershop_doShopCategory.action", map[string]interface{}{
result, err := a.AccessStorePage(categoryURL, map[string]interface{}{
"categoryJson": string(data),
}, true)
if err == nil {