package wechat import "context" // Service 微信服务接口 type Service interface { // GetUserInfo 通过授权码获取用户信息 GetUserInfo(ctx context.Context, code string) (openID, unionID string, err error) } // UserInfo 微信用户信息 type UserInfo struct { OpenID string `json:"open_id"` // 微信 OpenID UnionID string `json:"union_id"` // 微信 UnionID(开放平台统一ID) Nickname string `json:"nickname"` // 昵称 Avatar string `json:"avatar"` // 头像URL Sex int `json:"sex"` // 性别 0-未知 1-男 2-女 Province string `json:"province"` // 省份 City string `json:"city"` // 城市 Country string `json:"country"` // 国家 }