third_party

package
v1.6.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	WECHAT_ACCESS_TOKEN_KEY      = "WECHAT_ACCESS_TOKEN:%s"
	WECHAT_JSAPI_TICKET_KEY      = "WECHAT_JSAPI_TICKET:%s"
	WECHAT_STATE_KEY             = "WECHAT_STATE:%v"
	WECHAT_PLATFORM_KEY          = "WECHAT_PLATFORM:%v"
	WECHAT_REDIRECT_KEY          = "WECHAT_REDIRECT:%v"
	WECHAT_REDIRECT_EXP_KEY      = "WECHAT_REDIRECT_EXP:%v"
	WECHAT_USER_ACCESS_TOKEN_KEY = "WECHAT_USER_ACCESS_TOKEN:%v"
)

Wechat

Variables

View Source
var (
	WeChatQRLogin  = "snsapi_login"
	WeChatUserInfo = "snsapi_userinfo"
	WeChatBase     = "snsapi_base"
)
View Source
var (
	WeChatAccessTokenAddr = "https://api.weixin.qq.com/cgi-bin/token"
	WeChatJSApiTicketAddr = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"

	WeChatQRConnectAddr         = "https://open.weixin.qq.com/connect/qrconnect"
	WeChatAppConnectAddr        = "https://open.weixin.qq.com/connect/oauth2/authorize"
	WeChatUserAccessTokenAddr   = "https://api.weixin.qq.com/sns/oauth2/access_token"
	WeChatRefreshUserTokenAddr  = "https://api.weixin.qq.com/sns/oauth2/refresh_token"
	WeChatUserInfoAddr          = "https://api.weixin.qq.com/sns/userinfo"
	WeChatSubscribeUserInfoAddr = "https://api.weixin.qq.com/cgi-bin/user/info"

	WeChatTemplateMessageAddr = "https://api.weixin.qq.com/cgi-bin/message/template/send"
)

Functions

func GetWeChatClient added in v1.4.12

func GetWeChatClient(appId string) *http.Client

Types

type AdapterThirdParty

type AdapterThirdParty interface {
	String() string
	GetConnectUrl(state, scope string, popUp bool) (string, error)
	GetAccessToken() (string, int, error)
	GetJSApiTicket(accessToken string) (string, int, error)
	GetUserAccessToken(code, state string) (string, error)
	RefreshUserToken(refreshToken string, appId string) (string, error)
	GetUserInfo(userAccessToken, openId string) (string, error)
	GetSubscribeUserInfo(userAccessToken, openId string) (string, error)
	SendTemplateMessage(accessToken, openId, templateId, url string, data []byte, rootData []byte) (string, error)
	GetClient() interface{}
}

type WeChatClient added in v1.4.12

type WeChatClient struct {
	// contains filtered or unexported fields
}

func NewWeChatClient added in v1.4.12

func NewWeChatClient(client *http.Client, appId, appSecret, callbackAddr, appType string) *WeChatClient

func (*WeChatClient) Close added in v1.4.12

func (m *WeChatClient) Close()

Close 关闭连接

func (*WeChatClient) GetAccessToken added in v1.4.12

func (m *WeChatClient) GetAccessToken() (string, int, error)

func (*WeChatClient) GetClient added in v1.4.12

func (m *WeChatClient) GetClient() interface{}

GetClient 暴露原生client

func (*WeChatClient) GetConnectUrl added in v1.4.12

func (m *WeChatClient) GetConnectUrl(state, scope string, popUp bool) (string, error)

func (*WeChatClient) GetJSApiTicket added in v1.4.12

func (m *WeChatClient) GetJSApiTicket(accessToken string) (string, int, error)

func (*WeChatClient) GetSubscribeUserInfo added in v1.4.20

func (m *WeChatClient) GetSubscribeUserInfo(accessToken, openId string) (string, error)

func (*WeChatClient) GetUserAccessToken added in v1.4.12

func (m *WeChatClient) GetUserAccessToken(code, scope string) (string, error)

func (*WeChatClient) GetUserInfo added in v1.4.12

func (m *WeChatClient) GetUserInfo(userAccessToken, openId string) (string, error)

func (*WeChatClient) RefreshUserToken added in v1.4.12

func (m *WeChatClient) RefreshUserToken(refreshToken string, appId string) (string, error)

func (*WeChatClient) SendTemplateMessage added in v1.4.12

func (m *WeChatClient) SendTemplateMessage(accessToken, openId, templateId, redirectUrl string, data []byte, rootData []byte) (string, error)

func (*WeChatClient) String added in v1.4.12

func (m *WeChatClient) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL