wxapp

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOpenId

func GetOpenId(code string) (openId string, err error)

func GetUnionId

func GetUnionId(code string) (unionId string, err error)

Types

type LoginReply

type LoginReply struct {
	UInfo   *UserInfo
	Session *UserSession
}

func Login

func Login(code string) (*LoginReply, error)

type UserInfo

type UserInfo struct {
	NickName   string   `json:"nickname"`   // 昵称
	Sex        int      `json:"sex"`        // 普通用户性别,1 为男性,2 为女性
	City       string   `json:"city"`       // 城市
	Province   string   `json:"province"`   // 省份
	Country    string   `json:"country"`    // 国家,如中国为 CN
	HeadImgUrl string   `json:"headimgurl"` // 头像
	Privilege  []string `json:"privilege"`  // 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)
	OpenId     string   `json:"openid"`     // 普通用户的标识,对当前开发者帐号唯一
	UnionId    string   `json:"unionid"`    // 用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的 unionid 是唯一的。
}

type UserSession

type UserSession struct {
	AccessToken  string `json:"access_token"`  // 接口调用凭证
	ExpiresIn    int32  `json:"expires_in"`    // access_token 接口调用凭证超时时间,单位(秒)
	RefreshToken string `json:"refresh_token"` // 用户刷新 access_token
	OpenId       string `json:"openid"`        // 授权用户唯一标识
	Scope        string `json:"scope"`         // 用户授权的作用域,使用逗号(,)分隔
	Errcode      int    `json:"errcode"`       // 错误码
}

Jump to

Keyboard shortcuts

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