|
@@ -91,18 +91,12 @@ type ResAccessToken struct {
|
|
|
Data *TokenData `json:"data"`
|
|
Data *TokenData `json:"data"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type ResAccessToken2 struct {
|
|
|
|
|
- Msg string `json:"msg"`
|
|
|
|
|
- Code string `json:"code"`
|
|
|
|
|
- Data map[string]interface{} `json:"data"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func GetAccessTokenFromServer(ctx *wechatCtx.Context) (resAccessToken ResAccessToken, err error) {
|
|
func GetAccessTokenFromServer(ctx *wechatCtx.Context) (resAccessToken ResAccessToken, err error) {
|
|
|
var params = map[string]string{}
|
|
var params = map[string]string{}
|
|
|
params["platformId"] = os.Getenv("SDK_PLATFORMID")
|
|
params["platformId"] = os.Getenv("SDK_PLATFORMID")
|
|
|
params["appId"] = os.Getenv("SDK_APPID")
|
|
params["appId"] = os.Getenv("SDK_APPID")
|
|
|
params["wxAppId"] = os.Getenv("WECHAT_APPID")
|
|
params["wxAppId"] = os.Getenv("WECHAT_APPID")
|
|
|
- params["clearCache"] = "0"
|
|
|
|
|
|
|
+ params["clearCache"] = os.Getenv("SDK_CLEARCACHE")
|
|
|
params["requestTime"] = strconv.Itoa(int(util.GetNowSecond()))
|
|
params["requestTime"] = strconv.Itoa(int(util.GetNowSecond()))
|
|
|
|
|
|
|
|
res := AppSign(params, os.Getenv("SDK_APPKEY"))
|
|
res := AppSign(params, os.Getenv("SDK_APPKEY"))
|
|
@@ -112,11 +106,6 @@ func GetAccessTokenFromServer(ctx *wechatCtx.Context) (resAccessToken ResAccessT
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- var temp1 map[string]interface{}
|
|
|
|
|
- err = json.Unmarshal(body, &temp1)
|
|
|
|
|
-
|
|
|
|
|
- var temp ResAccessToken2
|
|
|
|
|
- err = json.Unmarshal(body, &temp)
|
|
|
|
|
|
|
|
|
|
err = json.Unmarshal(body, &resAccessToken)
|
|
err = json.Unmarshal(body, &resAccessToken)
|
|
|
if err != nil {
|
|
if err != nil {
|