feat 微信登录

This commit is contained in:
2026-01-14 10:53:27 +08:00
parent 7aec1c2d4f
commit 3750ff1c34
12 changed files with 235 additions and 25 deletions

View File

@@ -0,0 +1,54 @@
package wechat
type ResponseBase struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"`
}
type GetAccessTokenResp struct {
ResponseBase
AccessToken string `json:"access_token"`
ExpiresIn int32 `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
OpenID string `json:"openid"`
Scope string `json:"scope"`
UnionID string `json:"unionid"`
}
type GetUserInfoResp struct {
ResponseBase
NickName string `json:"nickname"`
HeadImgURL string `json:"headimgurl"`
UnionID string `json:"unionid"`
}
type Code2SessionResp struct {
ResponseBase
OpenID string `json:"openid"`
UnionID string `json:"unionid"`
}
type GetUserPhoneNumberResp struct {
ResponseBase
PhoneInfo *struct {
CountryCode string `json:"countryCode"`
PurePhoneNumber string `json:"purePhoneNumber"`
} `json:"phone_info"`
}
type GenerateSchemeResp struct {
ResponseBase
OpenLink string `json:"openlink"`
}
type GenerateURLLinkReq struct {
Path string `json:"path"` // 小程序页面路径
Query string `json:"query"` // 参数
ExpireTime int64 `json:"expire_time"` // 失效间隔时间
EnvVersion string `json:"env_version"` // 版本
}
type GenerateURLLinkResp struct {
ResponseBase
UrlLink string `json:"url_link"`
}