qq

package
v0.0.0-...-115e584 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0, GPL-3.0, GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type AccessToken

type AccessToken struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
}

type UserInfo

type UserInfo struct {
	Ret          int    `json:"ret"`            // 返回码
	Msg          string `json:"msg"`            // 如果ret<0,会有相应的错误信息提示,返回数据全部用UTF-8编码。
	Nickname     string `json:"nickname"`       // 用户在QQ空间的昵称。
	Figureurl    string `json:"figureurl"`      // 大小为30×30像素的QQ空间头像URL。
	Figureurl1   string `json:"figureurl_1"`    // 大小为50×50像素的QQ空间头像URL。
	Figureurl2   string `json:"figureurl_2"`    // 大小为100×100像素的QQ空间头像URL。
	FigureurlQQ1 string `json:"figureurl_qq_1"` // 大小为40×40像素的QQ头像URL。
	FigureurlQQ2 string `json:"figureurl_qq_2"` // 大小为100×100像素的QQ头像URL。需要注意,不是所有的用户都拥有QQ的100x100的头像,但40x40像素则是一定会有。
	Gender       string `json:"gender"`         // 性别。 如果获取不到则默认返回"男"
	Openid       string `json:"openid"`
	Unionid      string `json:"unionid"`
}

func GetUserInfo

func GetUserInfo(accessToken string) (*UserInfo, error)

获取用户信息 文档:https://wiki.connect.qq.com/get_user_info 接口:https://graph.qq.com/user/get_user_info

func GetUserInfoByCode

func GetUserInfoByCode(code, state string) (*UserInfo, error)

根据code获取用户信息 流程为先使用code换取accessToken,然后根据accessToken获取用户信息

Jump to

Keyboard shortcuts

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