美团配送状态,京东商城

This commit is contained in:
苏尹岚
2020-05-08 09:40:51 +08:00
parent f1d789b724
commit 221e8cf45f
6 changed files with 285 additions and 70 deletions

View File

@@ -245,8 +245,8 @@ func (a *API) AccessAPI2(baseURL, action string, params map[string]interface{})
err = platformapi.AccessPlatformAPIWithRetry(a.client,
func() *http.Request {
request, _ := http.NewRequest(http.MethodPost, baseURL+"/"+action, strings.NewReader(params2.Encode()))
request.Header.Set("charset", "UTF-8")
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
request.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
request.Header.Set("Referer", "https://page.peisong.meituan.com/open/admin/poilist")
if baseURL != mtpsAPIURL {
a.FillRequestCookies(request)
}

View File

@@ -25,7 +25,7 @@ func init() {
// prod
// api = New("3c0a05d464c247c19d7ec13accc78605", "b1M}9?:sTbsB[OF2gNORnN(|(iy9rB8(`7]|[wGLnbmt`evfM>E:A90DjHAW:UPE")
api.SetCookie("token", "M0p9VatZSeSHfrosD5IViAVl73IcA8mlcuHIV5sG6Zpv83a7JE0wY3t26aEhrrs_MR5gtLSFF1UIkt8HAjaXow")
api.SetCookie("token", "GsfR99YCT8leEBnY39YxPeWTJiSmetA3NGl8G8u1Mv29V4KLYIA9rH3fhw-uDL7VwM4jKPfNwH8D_vOPg3cRYg")
}
func handleError(t *testing.T, err error) {

View File

@@ -1,6 +1,10 @@
package mtpsapi
import "fmt"
import (
"fmt"
"git.rosy.net.cn/baseapi/utils"
)
func (a *API) PagePoiUpdate(outerPoiID, contactName, contactPhone, contactEmail string) (err error) {
if outerPoiID == "" || contactName == "" || contactPhone == "" || contactEmail == "" {
@@ -12,7 +16,7 @@ func (a *API) PagePoiUpdate(outerPoiID, contactName, contactPhone, contactEmail
"contactPhone": contactPhone,
"contactEmail": contactEmail,
}
_, err = a.AccessAPI2("https://peisong.meituan.com/api", "haikuiopen/haikui/open/partner/poi/update", params)
_, err = a.AccessAPI2("https://page.peisong.meituan.com/api", "haikuiopen/haikui/open/partner/poi/update", params)
return err
}
@@ -21,3 +25,39 @@ func (a *API) GetAccountDetail() (err error) {
_, err = a.AccessAPI2("https://peisong.meituan.com/api", "haikuiopen/haikui/open/partner/base/detail", params)
return err
}
type GetStoreStatusResult struct {
PoiID int `json:"poiId"`
OuterPoiID string `json:"outerPoiId"`
AppkeyID int `json:"appkeyId"`
PoiName string `json:"poiName"`
CityID int `json:"cityId"`
CityName string `json:"cityName"`
ContactPhone string `json:"contactPhone"`
ContactName interface{} `json:"contactName"`
ContactEmail interface{} `json:"contactEmail"`
Address string `json:"address"`
AddressDetail interface{} `json:"addressDetail"`
OpenType int `json:"openType"`
CategoryID int `json:"categoryId"`
SecondCategoryID int `json:"secondCategoryId"`
PoiLat int `json:"poiLat"`
PoiLng int `json:"poiLng"`
SubBrandID int `json:"subBrandId"`
PoiType int `json:"poiType"`
}
func (a *API) GetStoreStatus(poiName string) (getStoreStatusResult *GetStoreStatusResult, err error) {
params := map[string]interface{}{
"poiName": poiName,
"openType": -1,
"cityId": -1,
"pageNum": 1,
"pageSize": 20,
}
result, err := a.AccessAPI2("https://page.peisong.meituan.com/api", "haikuiopen/haikui/open/partner/poi/search", params)
if err == nil {
utils.Map2StructByJson(result.Data, &getStoreStatusResult, false)
}
return getStoreStatusResult, err
}

View File

@@ -2,10 +2,12 @@ package mtpsapi
import (
"testing"
"git.rosy.net.cn/baseapi/utils"
)
func TestPagePoiUpdate(t *testing.T) {
err := api.PagePoiUpdate("100082", "王海红", "16601189298", "727827081@qq.com")
err := api.PagePoiUpdate("666730", "任学梅", "15283376640", "feng.shi@rosy.net.cn")
if err != nil {
t.Fatal(err)
}
@@ -17,3 +19,11 @@ func TestGetAccountDetail(t *testing.T) {
t.Fatal(err)
}
}
func TestGetStoreStatus(t *testing.T) {
result, err := api.GetStoreStatus("肖坝路店")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}