From 172c4abde5c4b50153d24ff61fb3a0b97ec697a0 Mon Sep 17 00:00:00 2001 From: zxr615 <30486360+zxr615@users.noreply.github.com> Date: Wed, 5 Jan 2022 09:13:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87component=5Fverify=5Fticket?= =?UTF-8?q?=20=E8=8E=B7=E5=8F=96=20ComponentAccessToken=20=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E5=A4=84=E7=90=86=20(#521)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openplatform/context/accessToken.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openplatform/context/accessToken.go b/openplatform/context/accessToken.go index 7e42ed7..03bbbbf 100644 --- a/openplatform/context/accessToken.go +++ b/openplatform/context/accessToken.go @@ -26,6 +26,7 @@ const ( // ComponentAccessToken 第三方平台 type ComponentAccessToken struct { + util.CommonError AccessToken string `json:"component_access_token"` ExpiresIn int64 `json:"expires_in"` } @@ -57,6 +58,10 @@ func (ctx *Context) SetComponentAccessToken(verifyTicket string) (*ComponentAcce return nil, err } + if at.ErrCode != 0 { + return nil, fmt.Errorf("SetComponentAccessToken Error , errcode=%d , errmsg=%s", at.ErrCode, at.ErrMsg) + } + accessTokenCacheKey := fmt.Sprintf("component_access_token_%s", ctx.AppID) expires := at.ExpiresIn - 1500 if err := ctx.Cache.Set(accessTokenCacheKey, at.AccessToken, time.Duration(expires)*time.Second); err != nil {