1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-15 18:22:26 +08:00

fix: platform wx oauth and js config issue. (#302)

* fix: platform wx oauth and js config issue.

fix silenceper/wechat#301.

* fix: platform query auth code error not detected.

* feat: migrate platform oauth and js api.

* fix: func name
This commit is contained in:
NaRro
2020-08-01 20:44:01 +08:00
committed by GitHub
parent 811d71c35b
commit 6f2bd492fc
4 changed files with 139 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ import (
"github.com/silenceper/wechat/v2/officialaccount"
offConfig "github.com/silenceper/wechat/v2/officialaccount/config"
opContext "github.com/silenceper/wechat/v2/openplatform/context"
"github.com/silenceper/wechat/v2/openplatform/officialaccount/js"
"github.com/silenceper/wechat/v2/openplatform/officialaccount/oauth"
)
//OfficialAccount 代公众号实现业务
@@ -28,6 +30,16 @@ func NewOfficialAccount(opCtx *opContext.Context, appID string) *OfficialAccount
return &OfficialAccount{appID: appID, OfficialAccount: officialAccount}
}
// PlatformOauth 平台代发起oauth2网页授权
func (officialAccount *OfficialAccount) PlatformOauth() *oauth.Oauth {
return oauth.NewOauth(officialAccount.GetContext())
}
// PlatformJs 平台代获取js-sdk配置
func (officialAccount *OfficialAccount) PlatformJs() *js.Js {
return js.NewJs(officialAccount.GetContext())
}
//DefaultAuthrAccessToken 默认获取授权ak的方法
type DefaultAuthrAccessToken struct {
opCtx *opContext.Context