Documentation
¶
Index ¶
Constants ¶
View Source
const KeyOpenId = "open_id"
Variables ¶
View Source
var WxAppConfig = struct { AppId string Secret string }{}
Functions ¶
func GetProxy ¶
func GetProxy() *miniProgram.MiniProgram
func HandleWxAppAuth ¶
HandleWxAppAuth godoc @Tags 账户认证 @Summary 微信小程序授权认证 @Description 通过微信小程序的code进行用户认证 @Tags auth @Produce json @Param code query string true "微信小程序登录后获取的code" @Success 200 {object} response.Response{result=string} @Router /wxapp/auth [get]
func WxappCodeAuthFilter ¶
func WxappCodeAuthFilter() gin.HandlerFunc
WxappCodeAuthFilter 是一个中间件,用于验证微信小程序的登录码并获取会话信息 它首先解析和验证请求中的微信小程序登录码,然后通过微信API获取会话信息, 包括openid、session_key等,并将这些信息设置到请求上下文中,以便后续处理函数使用
func WxappRoutine ¶
func WxappRoutine() (repo *wxappRoutine)
Types ¶
type WechatAccount ¶
type WechatAccount struct {
database.Model
AccountId string `gorm:"index"`
Account account.Account `gorm:"foreignKey:AccountId"`
OpenId string `gorm:"unique;index;type:varchar(128)"` // 微信用户唯一标识
UnionId string `gorm:"index;type:varchar(128)"` // 微信开放平台唯一标识
AccessToken string `gorm:"type:varchar(512)"` // 微信访问令牌
RefreshToken string `gorm:"type:varchar(512)"` // 刷新令牌
ExpiresAt *time.Time // 令牌过期时间
Scope string `gorm:"type:varchar(128)"` // 授权范围
Source string `gorm:"type:varchar(32)"` // 来源:小程序/公众号
}
type WxAppCodeAuthRequest ¶
type WxAppCodeAuthRequest struct {
Code string `form:"code" validate:"required"`
}
Click to show internal directories.
Click to hide internal directories.