Documentation
¶
Index ¶
- func InitWechat()
- type GetAccessTokenResponse
- type GetUserInfoResponse
- type GetWechatOfficialAccoutAccessTokenResponse
- type GetWechatOfficialAccoutQRCodeResponse
- type GetWechatOfficialAccoutUserInfoResponse
- type MiniProgramConfig
- type QRConnectResult
- type SendTplMsgRequest
- type SendTplMsgResponse
- type WechatOpenPlatformWeb
- func (w *WechatOpenPlatformWeb) CheckAccessToken(unionID string) bool
- func (w *WechatOpenPlatformWeb) CheckWechatOfficialAccoutAccessToken(accessToken string) bool
- func (w *WechatOpenPlatformWeb) DecryptState(data, nonce string) (string, error)
- func (w *WechatOpenPlatformWeb) DeleteQRConnectResult(ticket string)
- func (w *WechatOpenPlatformWeb) EncryptState() (string, error)
- func (w *WechatOpenPlatformWeb) GetAccessToken(code string) (*GetAccessTokenResponse, error)
- func (w *WechatOpenPlatformWeb) GetAuthURL() (string, error)
- func (w *WechatOpenPlatformWeb) GetQRConnectResult(ticket string) *QRConnectResult
- func (w *WechatOpenPlatformWeb) GetUserInfo(unionID string) (*GetUserInfoResponse, error)
- func (w *WechatOpenPlatformWeb) GetWechatOfficialAccoutAccessToken() (*GetWechatOfficialAccoutAccessTokenResponse, error)
- func (w *WechatOpenPlatformWeb) GetWechatOfficialAccoutQRCode(isTemp bool, expireSeconds int) (*GetWechatOfficialAccoutQRCodeResponse, error)
- func (w *WechatOpenPlatformWeb) GetWechatOfficialAccoutUserInfo(openID string) (*GetWechatOfficialAccoutUserInfoResponse, error)
- func (w *WechatOpenPlatformWeb) RefreshAccessToken(unionID string) (string, error)
- func (w *WechatOpenPlatformWeb) SendTplMsg(req SendTplMsgRequest) (*SendTplMsgResponse, error)
- func (w *WechatOpenPlatformWeb) UpdateQRConnectResult(ticket string, finished bool, success bool, token string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitWechat ¶
func InitWechat()
Types ¶
type GetAccessTokenResponse ¶
type GetAccessTokenResponse struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` AccessToken string `json:"access_token"` ExpiresIn int64 `json:"expires_in"` RefreshToken string `json:"refresh_token"` OpenID string `json:"openid"` Scope string `json:"scope"` UnionID string `json:"unionid"` }
type GetUserInfoResponse ¶
type GetUserInfoResponse struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` OpenID string `json:"openid"` Nickname string `json:"nickname"` Sex int `json:"sex"` Province string `json:"province"` City string `json:"city"` Country string `json:"country"` HeadImgUrl string `json:"headimgurl"` Privilege []string `json:"privilege"` UnionID string `json:"unionid"` }
type GetWechatOfficialAccoutUserInfoResponse ¶
type GetWechatOfficialAccoutUserInfoResponse struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Subscribe int `json:"subscribe"` OpenID string `json:"openid"` Language string `json:"language"` SubscribeTime int64 `json:"subscribe_time"` UnionID string `json:"unionid"` Remark string `json:"remark"` GroupID int `json:"groupid"` TagIDList []int `json:"tagid_list"` SubscribeScene string `json:"subscribe_scene"` QrScene int `json:"qr_scene"` QrSceneStr string `json:"qr_scene_str"` }
type MiniProgramConfig ¶
type MiniProgramConfig struct { MiniProgram *miniprogram.MiniProgram MiniAppConfig *ucmodel.WechatConfig }
func GetMiniProgram ¶
func GetMiniProgram(app string) *MiniProgramConfig
type QRConnectResult ¶
type QRConnectResult struct { Response *GetWechatOfficialAccoutQRCodeResponse Finished bool Success bool Token string }
type SendTplMsgRequest ¶
type SendTplMsgRequest struct { ToUser string `json:"touser"` TemplateID string `json:"template_id"` Url string `json:"url"` Miniprogram struct { AppID string `json:"appid"` PagePath string `json:"pagepath"` } `json:"miniprogram"` ClientMsgID string `json:"client_msg_id"` Data map[string]map[string]string `json:"data"` }
type SendTplMsgResponse ¶
type WechatOpenPlatformWeb ¶
type WechatOpenPlatformWeb struct { // AppID is the app id of the wechat open platform web WechatConfig *ucmodel.WechatConfig AccessToken map[string]GetAccessTokenResponse OfficialAccoutAccessToken *GetWechatOfficialAccoutAccessTokenResponse // 存储Token,并且设置过期时间 QRConnectResult *cache.Cache // contains filtered or unexported fields }
func GetWechatOpenPlatformWeb ¶
func GetWechatOpenPlatformWeb(app string) *WechatOpenPlatformWeb
func NewWechatOpenPlatformWeb ¶
func NewWechatOpenPlatformWeb(wechatConfig *ucmodel.WechatConfig) *WechatOpenPlatformWeb
func (*WechatOpenPlatformWeb) CheckAccessToken ¶
func (w *WechatOpenPlatformWeb) CheckAccessToken(unionID string) bool
校验Token是否有效
func (*WechatOpenPlatformWeb) CheckWechatOfficialAccoutAccessToken ¶
func (w *WechatOpenPlatformWeb) CheckWechatOfficialAccoutAccessToken(accessToken string) bool
校验WechatOfficialAccoutAccessToken是否有效
func (*WechatOpenPlatformWeb) DecryptState ¶
func (w *WechatOpenPlatformWeb) DecryptState(data, nonce string) (string, error)
DecryptState 解密state参数
func (*WechatOpenPlatformWeb) DeleteQRConnectResult ¶
func (w *WechatOpenPlatformWeb) DeleteQRConnectResult(ticket string)
func (*WechatOpenPlatformWeb) EncryptState ¶
func (w *WechatOpenPlatformWeb) EncryptState() (string, error)
将AppName+当前时间戳使用Secret进行加密,作为state参数
func (*WechatOpenPlatformWeb) GetAccessToken ¶
func (w *WechatOpenPlatformWeb) GetAccessToken(code string) (*GetAccessTokenResponse, error)
GetAccessToken get access token by code
func (*WechatOpenPlatformWeb) GetAuthURL ¶
func (w *WechatOpenPlatformWeb) GetAuthURL() (string, error)
GetAuthURL get auth url
func (*WechatOpenPlatformWeb) GetQRConnectResult ¶
func (w *WechatOpenPlatformWeb) GetQRConnectResult(ticket string) *QRConnectResult
func (*WechatOpenPlatformWeb) GetUserInfo ¶
func (w *WechatOpenPlatformWeb) GetUserInfo(unionID string) (*GetUserInfoResponse, error)
获取个人信息
func (*WechatOpenPlatformWeb) GetWechatOfficialAccoutAccessToken ¶
func (w *WechatOpenPlatformWeb) GetWechatOfficialAccoutAccessToken() (*GetWechatOfficialAccoutAccessTokenResponse, error)
func (*WechatOpenPlatformWeb) GetWechatOfficialAccoutQRCode ¶
func (w *WechatOpenPlatformWeb) GetWechatOfficialAccoutQRCode(isTemp bool, expireSeconds int) (*GetWechatOfficialAccoutQRCodeResponse, error)
func (*WechatOpenPlatformWeb) GetWechatOfficialAccoutUserInfo ¶
func (w *WechatOpenPlatformWeb) GetWechatOfficialAccoutUserInfo(openID string) (*GetWechatOfficialAccoutUserInfoResponse, error)
func (*WechatOpenPlatformWeb) RefreshAccessToken ¶
func (w *WechatOpenPlatformWeb) RefreshAccessToken(unionID string) (string, error)
RefreshAccessToken refresh access token
func (*WechatOpenPlatformWeb) SendTplMsg ¶
func (w *WechatOpenPlatformWeb) SendTplMsg(req SendTplMsgRequest) (*SendTplMsgResponse, error)
func (*WechatOpenPlatformWeb) UpdateQRConnectResult ¶
func (w *WechatOpenPlatformWeb) UpdateQRConnectResult(ticket string, finished bool, success bool, token string)
Click to show internal directories.
Click to hide internal directories.