aa
This commit is contained in:
@@ -205,3 +205,27 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{
|
||||
func (a *API) AccessAPI(cmd string, isGet bool, bizParams map[string]interface{}) (retVal interface{}, err error) {
|
||||
return a.AccessAPI2(cmd, isGet, bizParams, resultKeyData, "")
|
||||
}
|
||||
|
||||
func (a *API) GetOAuthCode(appPoiCode string) (retVal interface{}, err error) {
|
||||
retVal, err = a.AccessAPI2("oauth/authorize", true, map[string]interface{}{
|
||||
"app_poi_code": appPoiCode,
|
||||
"response_type": "code",
|
||||
}, "code", "")
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
func (a *API) GetAccessToken(code string) (retVal interface{}, err error) {
|
||||
retVal, err = a.AccessAPI2("oauth/token", false, map[string]interface{}{
|
||||
"grant_type": "authorization_code",
|
||||
"code": code,
|
||||
}, "access_token", "")
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
func (a *API) RefreshToken(code string) (retVal interface{}, err error) {
|
||||
retVal, err = a.AccessAPI2("oauth/token", false, map[string]interface{}{
|
||||
"grant_type": "authorization_code",
|
||||
"code": code,
|
||||
}, "access_token", "")
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ func init() {
|
||||
baseapi.Init(sugarLogger)
|
||||
|
||||
// 菜市
|
||||
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "")
|
||||
// api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "")
|
||||
|
||||
// 果园
|
||||
// api = New("4123", "df2c88338b85f830cebce2a9eab56628", "")
|
||||
|
||||
//商超
|
||||
// api = New("5873", "41c479790a76f86326f89e8048964739", "") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
cookieStr := `
|
||||
acctId=62884810; token=0_0_vJux6rcmm0XIzoI885_aew-gnfofUw9SR-a-QkLw*; brandId=-1; wmPoiId=-1;
|
||||
`
|
||||
@@ -39,3 +39,19 @@ func TestAccessAPI(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestGetOAuthCode(t *testing.T) {
|
||||
result, err := api.GetOAuthCode("11011885")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestGetAccessToken(t *testing.T) {
|
||||
result, err := api.GetAccessToken("code_nsX2gj8sQFcB0bYr0iVJtg")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestPoiGetIDs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPoiMGet(t *testing.T) {
|
||||
result, err := api.PoiMGet([]string{"8675995"})
|
||||
result, err := api.PoiMGet([]string{"11011885"})
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -93,7 +93,7 @@ func TestPoiShipTimeUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPoiOpen(t *testing.T) {
|
||||
err := api.PoiOpen("6735933")
|
||||
err := api.PoiOpen("11011885")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user