Documentation
¶
Overview ¶
Package context 开放平台相关context
Index ¶
- Constants
- func ExpiryTimeSpan(expireInSeconds int64) int64
- type AuthBaseInfo
- type AuthFuncInfo
- type AuthorizerAccessToken
- type AuthorizerInfo
- type AuthrAccessToken
- type ComponentAccessToken
- type Context
- func (c *Context) GetAuthAccessToken(ctx context.Context, appId string) (string, error)
- func (c *Context) GetAuthInfo(ctx context.Context, appId string) (*AuthorizerInfo, *AuthBaseInfo, error)
- func (c *Context) GetBindComponentURL(ctx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
- func (c *Context) GetComponentAccessToken(ctx context.Context) (string, error)
- func (c *Context) GetComponentLoginPage(ctx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
- func (c *Context) GetPreCode(ctx context.Context) (string, error)
- func (c *Context) QueryAuthCode(ctx context.Context, authCode string) (*AuthBaseInfo, error)
- func (c *Context) SetComponentAccessToken(ctx context.Context, verifyTicket string) (*ComponentAccessToken, error)
- type ID
Constants ¶
View Source
const ( // 开放平台 AccessToken ComponentAccessTokenCacheKey = "WeiXin:Container:Open:AccessToken:%s" // 开放平台授权 公众号/小程序 AccessToken AuthorizerAccessTokenCacheKey = "WeiXin:Container:Open:AuthorizerAccessToken:%s" )
Variables ¶
This section is empty.
Functions ¶
func ExpiryTimeSpan ¶
Types ¶
type AuthBaseInfo ¶
type AuthBaseInfo struct {
AuthrAccessToken
FuncInfo []AuthFuncInfo `json:"func_info"`
}
AuthBaseInfo 授权的基本信息
type AuthFuncInfo ¶
type AuthFuncInfo struct {
FuncscopeCategory ID `json:"funcscope_category"`
}
AuthFuncInfo 授权的接口内容
type AuthorizerAccessToken ¶
type AuthorizerAccessToken struct {
AuthorizationInfoExpireTime int64 `json:"authorization_info_expire_time"`
AuthorizerAccessToken AuthrAccessToken `json:"authorizer_info"`
}
type AuthorizerInfo ¶
type AuthorizerInfo struct {
NickName string `json:"nick_name"`
HeadImg string `json:"head_img"`
ServiceTypeInfo ID `json:"service_type_info"`
VerifyTypeInfo ID `json:"verify_type_info"`
UserName string `json:"user_name"`
PrincipalName string `json:"principal_name"`
BusinessInfo struct {
OpenStore string `json:"open_store"`
OpenScan string `json:"open_scan"`
OpenPay string `json:"open_pay"`
OpenCard string `json:"open_card"`
OpenShake string `json:"open_shake"`
}
Alias string `json:"alias"`
QrcodeURL string `json:"qrcode_url"`
}
AuthorizerInfo 授权方详细信息
type AuthrAccessToken ¶
type AuthrAccessToken struct {
Appid string `json:"authorizer_appid"`
AccessToken string `json:"authorizer_access_token"`
ExpiresIn int64 `json:"expires_in"`
RefreshToken string `json:"authorizer_refresh_token"`
}
AuthrAccessToken 授权方AccessToken
type ComponentAccessToken ¶
type ComponentAccessToken struct {
util.CommonError
AccessToken string `json:"component_access_token"`
ExpiresIn int64 `json:"expires_in"`
}
ComponentAccessToken 第三方平台
type Context ¶
Context struct
func (*Context) GetAuthAccessToken ¶
GetAuthAccessToken 获取授权方AccessToken
func (*Context) GetAuthInfo ¶
func (c *Context) GetAuthInfo(ctx context.Context, appId string) (*AuthorizerInfo, *AuthBaseInfo, error)
GetAuthInfo 获取授权方的帐号基本信息
func (*Context) GetBindComponentURL ¶
func (c *Context) GetBindComponentURL(ctx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
GetBindComponentURL 获取第三方公众号授权链接(链接跳转,适用移动端)
func (*Context) GetComponentAccessToken ¶
GetComponentAccessToken 获取 ComponentAccessToken
func (*Context) GetComponentLoginPage ¶
func (c *Context) GetComponentLoginPage(ctx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
GetComponentLoginPage 获取第三方公众号授权链接(扫码授权)
func (*Context) GetPreCode ¶
GetPreCode 获取预授权码
func (*Context) QueryAuthCode ¶
QueryAuthCode 使用授权码换取公众号或小程序的接口调用凭据和授权信息
func (*Context) SetComponentAccessToken ¶
func (c *Context) SetComponentAccessToken(ctx context.Context, verifyTicket string) (*ComponentAccessToken, error)
SetComponentAccessToken 通过component_verify_ticket 获取 ComponentAccessToken
Click to show internal directories.
Click to hide internal directories.