mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-16 18:52:27 +08:00
[feature] Format the code and improve Mini Program authorization to o… (#473)
* [feature] Format the code and improve Mini Program authorization to obtain openid(miniprogram/auth/auth.go Code2Session) * [feature] CheckEncryptedData (https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.checkEncryptedData.html) * upgrade json error * upgrade json error Co-authored-by: houseme <houseme@outlook.com>
This commit is contained in:
@@ -15,19 +15,19 @@ const (
|
||||
userListURL = "https://api.weixin.qq.com/cgi-bin/user/get"
|
||||
)
|
||||
|
||||
//User 用户管理
|
||||
// User 用户管理
|
||||
type User struct {
|
||||
*context.Context
|
||||
}
|
||||
|
||||
//NewUser 实例化
|
||||
// NewUser 实例化
|
||||
func NewUser(context *context.Context) *User {
|
||||
user := new(User)
|
||||
user.Context = context
|
||||
return user
|
||||
}
|
||||
|
||||
//Info 用户基本信息
|
||||
// Info 用户基本信息
|
||||
type Info struct {
|
||||
util.CommonError
|
||||
|
||||
@@ -62,7 +62,7 @@ type OpenidList struct {
|
||||
NextOpenID string `json:"next_openid"`
|
||||
}
|
||||
|
||||
//GetUserInfo 获取用户基本信息
|
||||
// GetUserInfo 获取用户基本信息
|
||||
func (user *User) GetUserInfo(openID string) (userInfo *Info, err error) {
|
||||
var accessToken string
|
||||
accessToken, err = user.GetAccessToken()
|
||||
|
||||
Reference in New Issue
Block a user