From 461a2566167a48866719ccbb0b4ddec97ea06f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 18 May 2020 14:52:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E4=BF=AE=E6=94=B9api=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdshopapi/jxshopapi_test.go | 5 +---- platformapi/jdshopapi/store_page.go | 3 ++- platformapi/jdshopapi/store_page_test.go | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/platformapi/jdshopapi/jxshopapi_test.go b/platformapi/jdshopapi/jxshopapi_test.go index 9b82deb9..61c39f55 100644 --- a/platformapi/jdshopapi/jxshopapi_test.go +++ b/platformapi/jdshopapi/jxshopapi_test.go @@ -15,8 +15,5 @@ func init() { sugarLogger = logger.Sugar() baseapi.Init(sugarLogger) api = New("de8157b447584885910f429011e49cb93yjq", "E1D746D42474D5F1F1A10CECE75D99F6", "efa7e1d1a22640fa990e6cf164b28608") - // api.SetCookie("thor", "80FAF09E9A09B6E618A68057BDFCFCB8A8C57DD560CF7359196563E623D38D861A6F1385BF97F393DC9DF698C31B135CF8581989CEA89547A4DFD2082DF65677236A67EEE90E058628E86F6A01FBA9044CEC983112F7D3303F7EC83A75677A6B8172D7C1E4F6C1AEC55AF5737133FD6191830B23DEA63A829AC02708580AF9D21F29EB88918E95FBB55A54FCA03C2C8A") - api.SetCookieWithStr(` - thor=80FAF09E9A09B6E618A68057BDFCFCB8A8C57DD560CF7359196563E623D38D861A6F1385BF97F393DC9DF698C31B135CF8581989CEA89547A4DFD2082DF65677236A67EEE90E058628E86F6A01FBA9044CEC983112F7D3303F7EC83A75677A6B8172D7C1E4F6C1AEC55AF5737133FD6191830B23DEA63A829AC02708580AF9D21F29EB88918E95FBB55A54FCA03C2C8A; b-sec=S2JWP6CAFP7K4I6PXVBUVCO6YVXUX2JAPDHLX5RZUDE4YKCGOEXCIPM7K4YWXRXHIKTGIB3OVQ7UM; - `) + api.SetCookie("thor", "80FAF09E9A09B6E618A68057BDFCFCB80B57C077668C68E68C659988D87CA3D30CE71D7C176A2F674F9EFC12F1390A96A0C8EDB82467985D69FCA31025221D54466C846BA08AB136D63402989D94C9A4F8DF795EB804208BDC9E3A34D1CF385C1C74D400531A9EAA20E8AD46FBF30ED86D87215D74AEDA38DFE58689AC995A44D179162CFB6B35D013B98B8CAFD2BB19") } diff --git a/platformapi/jdshopapi/store_page.go b/platformapi/jdshopapi/store_page.go index 46e96cf2..926035ef 100644 --- a/platformapi/jdshopapi/store_page.go +++ b/platformapi/jdshopapi/store_page.go @@ -20,10 +20,11 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{}, var request *http.Request if isPost { request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(bizParams).Encode())) + request.Header.Set("Content-Type", "application/x-www-form-urlencoded") } else { request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil) + request.Header.Set("referer", "https: //stores.shop.jd.com/stores/storeinfolistview") } - request.Header.Set("Content-Type", "application/x-www-form-urlencoded") a.FillRequestCookies(request) return request }, diff --git a/platformapi/jdshopapi/store_page_test.go b/platformapi/jdshopapi/store_page_test.go index 612387d1..c812faef 100644 --- a/platformapi/jdshopapi/store_page_test.go +++ b/platformapi/jdshopapi/store_page_test.go @@ -20,7 +20,7 @@ func TestCreateShopCategory(t *testing.T) { } func TestUpdateStoreStatus(t *testing.T) { - err := api.UpdateStoreStatus(24330156, 6) + err := api.UpdateStoreStatus(24332466, 6) if err != nil { t.Fatal(err) }