🎨 swagger update
This commit is contained in:
@@ -228,9 +228,9 @@ func (CaptchaAPI) GenerateClickShapeCaptcha(c *gin.Context) {
|
|||||||
result.OkWithData(bt, c)
|
result.OkWithData(bt, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateSlideBasicCaptData 验证点击形状验证码
|
// GenerateSlideBasicCaptData 生成点击形状基础验证码
|
||||||
// @Summary 验证点击形状验证码
|
// @Summary 生成点击形状基础验证码
|
||||||
// @Description 验证点击形状验证码
|
// @Description 生成点击形状基础验证码
|
||||||
// @Tags 点击形状验证码
|
// @Tags 点击形状验证码
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/captcha/shape/check [get]
|
// @Router /api/captcha/shape/check [get]
|
||||||
@@ -315,9 +315,9 @@ func (CaptchaAPI) CheckSlideData(c *gin.Context) {
|
|||||||
result.FailWithMessage("fail", c)
|
result.FailWithMessage("fail", c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateSlideRegionCaptData 验证点击形状验证码
|
// GenerateSlideRegionCaptData 生成点击形状验证码
|
||||||
// @Summary 验证点击形状验证码
|
// @Summary 生成点击形状验证码
|
||||||
// @Description 验证点击形状验证码
|
// @Description 生成点击形状验证码
|
||||||
// @Tags 点击形状验证码
|
// @Tags 点击形状验证码
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/captcha/shape/slide/region/get [get]
|
// @Router /api/captcha/shape/slide/region/get [get]
|
||||||
|
@@ -52,7 +52,7 @@ type GiteeUser struct {
|
|||||||
// GetGiteeRedirectUrl 获取Gitee登录地址
|
// GetGiteeRedirectUrl 获取Gitee登录地址
|
||||||
// @Summary 获取Gitee登录地址
|
// @Summary 获取Gitee登录地址
|
||||||
// @Description 获取Gitee登录地址
|
// @Description 获取Gitee登录地址
|
||||||
// @Tags OAuth
|
// @Tags Gitee OAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {string} string "登录地址"
|
// @Success 200 {string} string "登录地址"
|
||||||
// @Router /api/oauth/gitee/get_url [get]
|
// @Router /api/oauth/gitee/get_url [get]
|
||||||
@@ -131,7 +131,7 @@ func GetGiteeUserInfo(token *Token) (map[string]interface{}, error) {
|
|||||||
// GiteeCallback 处理Gitee回调
|
// GiteeCallback 处理Gitee回调
|
||||||
// @Summary 处理Gitee回调
|
// @Summary 处理Gitee回调
|
||||||
// @Description 处理Gitee回调
|
// @Description 处理Gitee回调
|
||||||
// @Tags OAuth
|
// @Tags Gitee OAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Router /api/oauth/gitee/callback [get]
|
// @Router /api/oauth/gitee/callback [get]
|
||||||
func (OAuthAPI) GiteeCallback(c *gin.Context) {
|
func (OAuthAPI) GiteeCallback(c *gin.Context) {
|
||||||
|
@@ -55,7 +55,7 @@ type GitHubUser struct {
|
|||||||
// GetRedirectUrl 获取github登录url
|
// GetRedirectUrl 获取github登录url
|
||||||
// @Summary 获取github登录url
|
// @Summary 获取github登录url
|
||||||
// @Description 获取github登录url
|
// @Description 获取github登录url
|
||||||
// @Tags OAuth
|
// @Tags Github OAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {string} string "登录url"
|
// @Success 200 {string} string "登录url"
|
||||||
// @Router /api/oauth/github/get_url [get]
|
// @Router /api/oauth/github/get_url [get]
|
||||||
@@ -135,7 +135,7 @@ func GetUserInfo(token *Token) (map[string]interface{}, error) {
|
|||||||
// Callback 登录回调函数
|
// Callback 登录回调函数
|
||||||
// @Summary 登录回调函数
|
// @Summary 登录回调函数
|
||||||
// @Description 登录回调函数
|
// @Description 登录回调函数
|
||||||
// @Tags OAuth
|
// @Tags Github OAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param code query string true "code"
|
// @Param code query string true "code"
|
||||||
// @Success 200 {string} string "登录成功"
|
// @Success 200 {string} string "登录成功"
|
||||||
|
@@ -52,7 +52,7 @@ type QQUserInfo struct {
|
|||||||
// GetQQRedirectUrl 获取登录地址
|
// GetQQRedirectUrl 获取登录地址
|
||||||
// @Summary 获取QQ登录地址
|
// @Summary 获取QQ登录地址
|
||||||
// @Description 获取QQ登录地址
|
// @Description 获取QQ登录地址
|
||||||
// @Tags 登录
|
// @Tags QQ OAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {string} string "登录地址"
|
// @Success 200 {string} string "登录地址"
|
||||||
// @Router /api/oauth/qq/get_url [get]
|
// @Router /api/oauth/qq/get_url [get]
|
||||||
@@ -162,7 +162,7 @@ func GetQQUserUserInfo(token *QQToken, openId string) (map[string]interface{}, e
|
|||||||
// QQCallback QQ登录回调
|
// QQCallback QQ登录回调
|
||||||
// @Summary QQ登录回调
|
// @Summary QQ登录回调
|
||||||
// @Description QQ登录回调
|
// @Description QQ登录回调
|
||||||
// @Tags 登录
|
// @Tags QQ OAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Router /api/oauth/qq/callback [get]
|
// @Router /api/oauth/qq/callback [get]
|
||||||
func (OAuthAPI) QQCallback(c *gin.Context) {
|
func (OAuthAPI) QQCallback(c *gin.Context) {
|
||||||
|
@@ -32,34 +32,40 @@ import (
|
|||||||
// GenerateClientId 生成客户端ID
|
// GenerateClientId 生成客户端ID
|
||||||
// @Summary 生成客户端ID
|
// @Summary 生成客户端ID
|
||||||
// @Description 生成客户端ID
|
// @Description 生成客户端ID
|
||||||
|
// @Tags 微信公众号
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Router /api/oauth/generate_client_id [get]
|
// @Router /api/oauth/generate_client_id [get]
|
||||||
func (OAuthAPI) GenerateClientId(c *gin.Context) {
|
func (OAuthAPI) GenerateClientId(c *gin.Context) {
|
||||||
// 尝试从 X-Real-IP 头部获取真实 IP
|
// 获取客户端IP
|
||||||
ip := c.GetHeader("X-Real-IP")
|
ip := c.GetHeader("X-Real-IP")
|
||||||
|
|
||||||
// 如果 X-Real-IP 头部不存在,则尝试从 X-Forwarded-For 头部获取
|
|
||||||
if ip == "" {
|
if ip == "" {
|
||||||
ip = c.GetHeader("X-Forwarded-For")
|
ip = c.GetHeader("X-Forwarded-For")
|
||||||
}
|
}
|
||||||
// 如果两者都不存在,则使用默认的 ClientIP 方法获取 IP
|
|
||||||
if ip == "" {
|
if ip == "" {
|
||||||
ip = c.ClientIP()
|
ip = c.ClientIP()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 从Redis获取客户端ID
|
||||||
clientId := redis.Get(constant.UserLoginClientRedisKey + ip).Val()
|
clientId := redis.Get(constant.UserLoginClientRedisKey + ip).Val()
|
||||||
if clientId != "" {
|
if clientId != "" {
|
||||||
result.OkWithData(clientId, c)
|
result.OkWithData(clientId, c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成新的客户端ID
|
||||||
v1 := uuid.NewV1()
|
v1 := uuid.NewV1()
|
||||||
redis.Set(constant.UserLoginClientRedisKey+ip, v1.String(), 0)
|
err := redis.Set(constant.UserLoginClientRedisKey+ip, v1.String(), 0).Err()
|
||||||
|
if err != nil {
|
||||||
|
global.LOG.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
result.OkWithData(v1.String(), c)
|
result.OkWithData(v1.String(), c)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CallbackNotify 微信回调验证
|
// CallbackNotify 微信回调
|
||||||
// @Summary 微信回调验证
|
// @Summary 微信回调
|
||||||
// @Description 微信回调验证
|
// @Tags 微信公众号
|
||||||
|
// @Description 微信回调
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Router /api/oauth/callback_notify [POST]
|
// @Router /api/oauth/callback_notify [POST]
|
||||||
func (OAuthAPI) CallbackNotify(c *gin.Context) {
|
func (OAuthAPI) CallbackNotify(c *gin.Context) {
|
||||||
@@ -132,6 +138,7 @@ func (OAuthAPI) CallbackNotify(c *gin.Context) {
|
|||||||
|
|
||||||
// CallbackVerify 微信回调验证
|
// CallbackVerify 微信回调验证
|
||||||
// @Summary 微信回调验证
|
// @Summary 微信回调验证
|
||||||
|
// @Tags 微信公众号
|
||||||
// @Description 微信回调验证
|
// @Description 微信回调验证
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Router /api/oauth/callback_verify [get]
|
// @Router /api/oauth/callback_verify [get]
|
||||||
@@ -145,20 +152,18 @@ func (OAuthAPI) CallbackVerify(c *gin.Context) {
|
|||||||
|
|
||||||
// GetTempQrCode 获取临时二维码
|
// GetTempQrCode 获取临时二维码
|
||||||
// @Summary 获取临时二维码
|
// @Summary 获取临时二维码
|
||||||
|
// @Tags 微信公众号
|
||||||
// @Description 获取临时二维码
|
// @Description 获取临时二维码
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param client_id query string true "客户端ID"
|
// @Param client_id query string true "客户端ID"
|
||||||
// @Router /api/oauth/get_temp_qrcode [get]
|
// @Router /api/oauth/get_temp_qrcode [get]
|
||||||
func (OAuthAPI) GetTempQrCode(c *gin.Context) {
|
func (OAuthAPI) GetTempQrCode(c *gin.Context) {
|
||||||
clientId := c.Query("client_id")
|
clientId := c.Query("client_id")
|
||||||
// 尝试从 X-Real-IP 头部获取真实 IP
|
// 获取客户端IP
|
||||||
ip := c.GetHeader("X-Real-IP")
|
ip := c.GetHeader("X-Real-IP")
|
||||||
|
|
||||||
// 如果 X-Real-IP 头部不存在,则尝试从 X-Forwarded-For 头部获取
|
|
||||||
if ip == "" {
|
if ip == "" {
|
||||||
ip = c.GetHeader("X-Forwarded-For")
|
ip = c.GetHeader("X-Forwarded-For")
|
||||||
}
|
}
|
||||||
// 如果两者都不存在,则使用默认的 ClientIP 方法获取 IP
|
|
||||||
if ip == "" {
|
if ip == "" {
|
||||||
ip = c.ClientIP()
|
ip = c.ClientIP()
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,16 @@ func (SmsAPI) SendMessageByAli(c *gin.Context) {
|
|||||||
result.FailWithMessage(ginI18n.MustGetMessage(c, "PhoneNotEmpty"), c)
|
result.FailWithMessage(ginI18n.MustGetMessage(c, "PhoneNotEmpty"), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
isPhone := utils.IsPhone(phone)
|
||||||
|
if !isPhone {
|
||||||
|
result.FailWithMessage(ginI18n.MustGetMessage(c, "PhoneErrorFormat"), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val := redis.Get(constant.UserLoginSmsRedisKey + phone).Val()
|
||||||
|
if val != "" {
|
||||||
|
result.FailWithMessage(ginI18n.MustGetMessage(c, "CaptchaTooOften"), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
sms := gosms.NewParser(gateways.Gateways{
|
sms := gosms.NewParser(gateways.Gateways{
|
||||||
ALiYun: aliyun.ALiYun{
|
ALiYun: aliyun.ALiYun{
|
||||||
Host: global.CONFIG.SMS.Ali.Host,
|
Host: global.CONFIG.SMS.Ali.Host,
|
||||||
@@ -36,6 +46,11 @@ func (SmsAPI) SendMessageByAli(c *gin.Context) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
code := utils.GenValidateCode(6)
|
code := utils.GenValidateCode(6)
|
||||||
|
wrong := redis.Set(constant.UserLoginSmsRedisKey+phone, code, time.Minute).Err()
|
||||||
|
if wrong != nil {
|
||||||
|
global.LOG.Error(wrong)
|
||||||
|
return
|
||||||
|
}
|
||||||
_, err := sms.Send(phone, gosms.MapStringAny{
|
_, err := sms.Send(phone, gosms.MapStringAny{
|
||||||
"content": "您的验证码是:****。请不要把验证码泄露给其他人。",
|
"content": "您的验证码是:****。请不要把验证码泄露给其他人。",
|
||||||
"template": global.CONFIG.SMS.Ali.TemplateID,
|
"template": global.CONFIG.SMS.Ali.TemplateID,
|
||||||
@@ -55,7 +70,7 @@ func (SmsAPI) SendMessageByAli(c *gin.Context) {
|
|||||||
|
|
||||||
// SendMessageBySmsBao 短信宝发送短信验证码
|
// SendMessageBySmsBao 短信宝发送短信验证码
|
||||||
// @Summary 短信宝发送短信验证码
|
// @Summary 短信宝发送短信验证码
|
||||||
// @Description 发送短信验证码
|
// @Description 短信宝发送短信验证码
|
||||||
// @Tags 短信验证码
|
// @Tags 短信验证码
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param phone query string true "手机号"
|
// @Param phone query string true "手机号"
|
||||||
@@ -66,6 +81,16 @@ func (SmsAPI) SendMessageBySmsBao(c *gin.Context) {
|
|||||||
result.FailWithMessage(ginI18n.MustGetMessage(c, "PhoneNotEmpty"), c)
|
result.FailWithMessage(ginI18n.MustGetMessage(c, "PhoneNotEmpty"), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
isPhone := utils.IsPhone(phone)
|
||||||
|
if !isPhone {
|
||||||
|
result.FailWithMessage(ginI18n.MustGetMessage(c, "PhoneErrorFormat"), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val := redis.Get(constant.UserLoginSmsRedisKey + phone).Val()
|
||||||
|
if val != "" {
|
||||||
|
result.FailWithMessage(ginI18n.MustGetMessage(c, "CaptchaTooOften"), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
sms := gosms.NewParser(gateways.Gateways{
|
sms := gosms.NewParser(gateways.Gateways{
|
||||||
SmsBao: smsbao.SmsBao{
|
SmsBao: smsbao.SmsBao{
|
||||||
User: global.CONFIG.SMS.SmsBao.User,
|
User: global.CONFIG.SMS.SmsBao.User,
|
||||||
@@ -73,6 +98,11 @@ func (SmsAPI) SendMessageBySmsBao(c *gin.Context) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
code := utils.GenValidateCode(6)
|
code := utils.GenValidateCode(6)
|
||||||
|
wrong := redis.Set(constant.UserLoginSmsRedisKey+phone, code, time.Minute).Err()
|
||||||
|
if wrong != nil {
|
||||||
|
global.LOG.Error(wrong)
|
||||||
|
return
|
||||||
|
}
|
||||||
_, err := sms.Send(phone, gosms.MapStringAny{
|
_, err := sms.Send(phone, gosms.MapStringAny{
|
||||||
"content": "您的验证码是:" + code + "。请不要把验证码泄露给其他人。",
|
"content": "您的验证码是:" + code + "。请不要把验证码泄露给其他人。",
|
||||||
}, nil)
|
}, nil)
|
||||||
|
@@ -27,7 +27,7 @@ var roleService = service.Service.RoleService
|
|||||||
|
|
||||||
// GetUserList
|
// GetUserList
|
||||||
// @Summary 获取所有用户列表
|
// @Summary 获取所有用户列表
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/auth/user/List [get]
|
// @Router /api/auth/user/List [get]
|
||||||
func (UserAPI) GetUserList(c *gin.Context) {
|
func (UserAPI) GetUserList(c *gin.Context) {
|
||||||
@@ -37,7 +37,7 @@ func (UserAPI) GetUserList(c *gin.Context) {
|
|||||||
|
|
||||||
// QueryUserByUsername
|
// QueryUserByUsername
|
||||||
// @Summary 根据用户名查询用户
|
// @Summary 根据用户名查询用户
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param username query string true "用户名"
|
// @Param username query string true "用户名"
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/auth/user/query_by_username [get]
|
// @Router /api/auth/user/query_by_username [get]
|
||||||
@@ -53,7 +53,7 @@ func (UserAPI) QueryUserByUsername(c *gin.Context) {
|
|||||||
|
|
||||||
// QueryUserByUuid
|
// QueryUserByUuid
|
||||||
// @Summary 根据uuid查询用户
|
// @Summary 根据uuid查询用户
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param uuid query string true "用户uuid"
|
// @Param uuid query string true "用户uuid"
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/auth/user/query_by_uuid [get]
|
// @Router /api/auth/user/query_by_uuid [get]
|
||||||
@@ -73,7 +73,7 @@ func (UserAPI) QueryUserByUuid(c *gin.Context) {
|
|||||||
|
|
||||||
// DeleteUser 删除用户
|
// DeleteUser 删除用户
|
||||||
// @Summary 删除用户
|
// @Summary 删除用户
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param uuid query string true "用户uuid"
|
// @Param uuid query string true "用户uuid"
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/auth/user/delete [delete]
|
// @Router /api/auth/user/delete [delete]
|
||||||
@@ -89,7 +89,7 @@ func (UserAPI) DeleteUser(c *gin.Context) {
|
|||||||
|
|
||||||
// QueryUserByPhone 根据手机号查询用户
|
// QueryUserByPhone 根据手机号查询用户
|
||||||
// @Summary 根据手机号查询用户
|
// @Summary 根据手机号查询用户
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param phone query string true "手机号"
|
// @Param phone query string true "手机号"
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/auth/user/query_by_phone [get]
|
// @Router /api/auth/user/query_by_phone [get]
|
||||||
@@ -105,7 +105,7 @@ func (UserAPI) QueryUserByPhone(c *gin.Context) {
|
|||||||
|
|
||||||
// AddUser 添加用户
|
// AddUser 添加用户
|
||||||
// @Summary 添加用户
|
// @Summary 添加用户
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param user body dto.AddUserRequest true "用户信息"
|
// @Param user body dto.AddUserRequest true "用户信息"
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/user/add [post]
|
// @Router /api/user/add [post]
|
||||||
@@ -161,7 +161,7 @@ func (UserAPI) AddUser(c *gin.Context) {
|
|||||||
|
|
||||||
// AccountLogin 账号登录
|
// AccountLogin 账号登录
|
||||||
// @Summary 账号登录
|
// @Summary 账号登录
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param user body dto.AccountLoginRequest true "用户信息"
|
// @Param user body dto.AccountLoginRequest true "用户信息"
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/user/login [post]
|
// @Router /api/user/login [post]
|
||||||
@@ -235,9 +235,8 @@ func (UserAPI) AccountLogin(c *gin.Context) {
|
|||||||
|
|
||||||
// PhoneLogin 手机号登录/注册
|
// PhoneLogin 手机号登录/注册
|
||||||
// @Summary 手机号登录/注册
|
// @Summary 手机号登录/注册
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param phone query string true "手机号"
|
// @Param user body dto.PhoneLoginRequest true "用户信息"
|
||||||
// @Param captcha query string true "验证码"
|
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/user/phone_login [post]
|
// @Router /api/user/phone_login [post]
|
||||||
func (UserAPI) PhoneLogin(c *gin.Context) {
|
func (UserAPI) PhoneLogin(c *gin.Context) {
|
||||||
@@ -311,7 +310,7 @@ func (UserAPI) PhoneLogin(c *gin.Context) {
|
|||||||
|
|
||||||
// RefreshHandler 刷新token
|
// RefreshHandler 刷新token
|
||||||
// @Summary 刷新token
|
// @Summary 刷新token
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param refresh_token query string true "刷新token"
|
// @Param refresh_token query string true "刷新token"
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/token/refresh [post]
|
// @Router /api/token/refresh [post]
|
||||||
@@ -427,7 +426,7 @@ func handelUserLogin(user model.ScaAuthUser, autoLogin bool, c *gin.Context) {
|
|||||||
|
|
||||||
// ResetPassword 重置密码
|
// ResetPassword 重置密码
|
||||||
// @Summary 重置密码
|
// @Summary 重置密码
|
||||||
// @Tags 鉴权模块
|
// @Tags 用户模块
|
||||||
// @Param user body dto.ResetPasswordRequest true "用户信息"
|
// @Param user body dto.ResetPasswordRequest true "用户信息"
|
||||||
// @Success 200 {string} json
|
// @Success 200 {string} json
|
||||||
// @Router /api/user/reset_password [post]
|
// @Router /api/user/reset_password [post]
|
||||||
|
@@ -16,6 +16,11 @@ const (
|
|||||||
|
|
||||||
var Handler = NewWebSocket()
|
var Handler = NewWebSocket()
|
||||||
|
|
||||||
|
// NewGWSServer 创建websocket服务
|
||||||
|
// @Summary 创建websocket服务
|
||||||
|
// @Description 创建websocket服务
|
||||||
|
// @Tags websocket
|
||||||
|
// @Router /api/ws/gws [get]
|
||||||
func (WebsocketAPI) NewGWSServer(c *gin.Context) {
|
func (WebsocketAPI) NewGWSServer(c *gin.Context) {
|
||||||
|
|
||||||
upgrader := gws.NewUpgrader(Handler, &gws.ServerOption{
|
upgrader := gws.NewUpgrader(Handler, &gws.ServerOption{
|
||||||
|
@@ -20,7 +20,11 @@ var (
|
|||||||
mux sync.Mutex
|
mux sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSocketClient 建立websocket长链接接口处理函数
|
// NewSocketClient 创建websocket服务
|
||||||
|
// @Summary 创建websocket服务(gorilla)
|
||||||
|
// @Description 创建websocket服务
|
||||||
|
// @Tags websocket
|
||||||
|
// @Router /api/ws/socket [get]
|
||||||
func (WebsocketAPI) NewSocketClient(context *gin.Context) {
|
func (WebsocketAPI) NewSocketClient(context *gin.Context) {
|
||||||
id := context.Query("client_id")
|
id := context.Query("client_id")
|
||||||
global.LOG.Println(id + "websocket链接")
|
global.LOG.Println(id + "websocket链接")
|
||||||
|
9
config/conf_swagger.go
Normal file
9
config/conf_swagger.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
type Swagger struct {
|
||||||
|
Enabled bool `yaml:"enable"`
|
||||||
|
Title string `yaml:"title"`
|
||||||
|
Description string `yaml:"description"`
|
||||||
|
User string `yaml:"user"`
|
||||||
|
Password string `yaml:"password"`
|
||||||
|
}
|
@@ -10,4 +10,5 @@ type Config struct {
|
|||||||
Encrypt Encrypt `yaml:"encrypt"`
|
Encrypt Encrypt `yaml:"encrypt"`
|
||||||
Wechat Wechat `yaml:"wechat"`
|
Wechat Wechat `yaml:"wechat"`
|
||||||
OAuth OAuth `yaml:"oauth"`
|
OAuth OAuth `yaml:"oauth"`
|
||||||
|
Swagger Swagger `yaml:"swagger"`
|
||||||
}
|
}
|
||||||
|
114
docs/docs.go
114
docs/docs.go
@@ -18,7 +18,7 @@ const docTemplate = `{
|
|||||||
"/api/auth/user/List": {
|
"/api/auth/user/List": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "获取所有用户列表",
|
"summary": "获取所有用户列表",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -34,7 +34,7 @@ const docTemplate = `{
|
|||||||
"/api/auth/user/delete": {
|
"/api/auth/user/delete": {
|
||||||
"delete": {
|
"delete": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "删除用户",
|
"summary": "删除用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -59,7 +59,7 @@ const docTemplate = `{
|
|||||||
"/api/auth/user/query_by_phone": {
|
"/api/auth/user/query_by_phone": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "根据手机号查询用户",
|
"summary": "根据手机号查询用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -84,7 +84,7 @@ const docTemplate = `{
|
|||||||
"/api/auth/user/query_by_username": {
|
"/api/auth/user/query_by_username": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "根据用户名查询用户",
|
"summary": "根据用户名查询用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -109,7 +109,7 @@ const docTemplate = `{
|
|||||||
"/api/auth/user/query_by_uuid": {
|
"/api/auth/user/query_by_uuid": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "根据uuid查询用户",
|
"summary": "根据uuid查询用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -183,11 +183,11 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"/api/captcha/shape/check": {
|
"/api/captcha/shape/check": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "验证点击形状验证码",
|
"description": "生成点击形状基础验证码",
|
||||||
"tags": [
|
"tags": [
|
||||||
"点击形状验证码"
|
"点击形状验证码"
|
||||||
],
|
],
|
||||||
"summary": "验证点击形状验证码",
|
"summary": "生成点击形状基础验证码",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
@@ -250,11 +250,11 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"/api/captcha/shape/slide/region/get": {
|
"/api/captcha/shape/slide/region/get": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "验证点击形状验证码",
|
"description": "生成点击形状验证码",
|
||||||
"tags": [
|
"tags": [
|
||||||
"点击形状验证码"
|
"点击形状验证码"
|
||||||
],
|
],
|
||||||
"summary": "验证点击形状验证码",
|
"summary": "生成点击形状验证码",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
@@ -326,11 +326,14 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"/api/oauth/callback_notify": {
|
"/api/oauth/callback_notify": {
|
||||||
"post": {
|
"post": {
|
||||||
"description": "微信回调验证",
|
"description": "微信回调",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"summary": "微信回调验证",
|
"tags": [
|
||||||
|
"微信公众号"
|
||||||
|
],
|
||||||
|
"summary": "微信回调",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -340,6 +343,9 @@ const docTemplate = `{
|
|||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"微信公众号"
|
||||||
|
],
|
||||||
"summary": "微信回调验证",
|
"summary": "微信回调验证",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
}
|
}
|
||||||
@@ -350,6 +356,9 @@ const docTemplate = `{
|
|||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"微信公众号"
|
||||||
|
],
|
||||||
"summary": "生成客户端ID",
|
"summary": "生成客户端ID",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
}
|
}
|
||||||
@@ -360,6 +369,9 @@ const docTemplate = `{
|
|||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"微信公众号"
|
||||||
|
],
|
||||||
"summary": "获取临时二维码",
|
"summary": "获取临时二维码",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -380,7 +392,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"OAuth"
|
"Gitee OAuth"
|
||||||
],
|
],
|
||||||
"summary": "处理Gitee回调",
|
"summary": "处理Gitee回调",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
@@ -393,7 +405,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"OAuth"
|
"Gitee OAuth"
|
||||||
],
|
],
|
||||||
"summary": "获取Gitee登录地址",
|
"summary": "获取Gitee登录地址",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -413,7 +425,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"OAuth"
|
"Github OAuth"
|
||||||
],
|
],
|
||||||
"summary": "登录回调函数",
|
"summary": "登录回调函数",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -442,7 +454,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"OAuth"
|
"Github OAuth"
|
||||||
],
|
],
|
||||||
"summary": "获取github登录url",
|
"summary": "获取github登录url",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -462,7 +474,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"登录"
|
"QQ OAuth"
|
||||||
],
|
],
|
||||||
"summary": "QQ登录回调",
|
"summary": "QQ登录回调",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
@@ -475,7 +487,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"登录"
|
"QQ OAuth"
|
||||||
],
|
],
|
||||||
"summary": "获取QQ登录地址",
|
"summary": "获取QQ登录地址",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -512,7 +524,7 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"/api/sms/smsbao/send": {
|
"/api/sms/smsbao/send": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "发送短信验证码",
|
"description": "短信宝发送短信验证码",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -557,7 +569,7 @@ const docTemplate = `{
|
|||||||
"/api/token/refresh": {
|
"/api/token/refresh": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "刷新token",
|
"summary": "刷新token",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -582,7 +594,7 @@ const docTemplate = `{
|
|||||||
"/api/user/add": {
|
"/api/user/add": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "添加用户",
|
"summary": "添加用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -609,7 +621,7 @@ const docTemplate = `{
|
|||||||
"/api/user/login": {
|
"/api/user/login": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "账号登录",
|
"summary": "账号登录",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -636,23 +648,18 @@ const docTemplate = `{
|
|||||||
"/api/user/phone_login": {
|
"/api/user/phone_login": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "手机号登录/注册",
|
"summary": "手机号登录/注册",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"description": "用户信息",
|
||||||
"description": "手机号",
|
"name": "user",
|
||||||
"name": "phone",
|
"in": "body",
|
||||||
"in": "query",
|
"required": true,
|
||||||
"required": true
|
"schema": {
|
||||||
},
|
"$ref": "#/definitions/dto.PhoneLoginRequest"
|
||||||
{
|
}
|
||||||
"type": "string",
|
|
||||||
"description": "验证码",
|
|
||||||
"name": "captcha",
|
|
||||||
"in": "query",
|
|
||||||
"required": true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -668,7 +675,7 @@ const docTemplate = `{
|
|||||||
"/api/user/reset_password": {
|
"/api/user/reset_password": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "重置密码",
|
"summary": "重置密码",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -691,6 +698,26 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/api/ws/gws": {
|
||||||
|
"get": {
|
||||||
|
"description": "创建websocket服务",
|
||||||
|
"tags": [
|
||||||
|
"websocket"
|
||||||
|
],
|
||||||
|
"summary": "创建websocket服务",
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/ws/socket": {
|
||||||
|
"get": {
|
||||||
|
"description": "创建websocket服务",
|
||||||
|
"tags": [
|
||||||
|
"websocket"
|
||||||
|
],
|
||||||
|
"summary": "创建websocket服务(gorilla)",
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
@@ -700,6 +727,9 @@ const docTemplate = `{
|
|||||||
"account": {
|
"account": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"auto_login": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"password": {
|
"password": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -719,6 +749,20 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.PhoneLoginRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"auto_login": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"captcha": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phone": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.ResetPasswordRequest": {
|
"dto.ResetPasswordRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
"/api/auth/user/List": {
|
"/api/auth/user/List": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "获取所有用户列表",
|
"summary": "获取所有用户列表",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"/api/auth/user/delete": {
|
"/api/auth/user/delete": {
|
||||||
"delete": {
|
"delete": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "删除用户",
|
"summary": "删除用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"/api/auth/user/query_by_phone": {
|
"/api/auth/user/query_by_phone": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "根据手机号查询用户",
|
"summary": "根据手机号查询用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
"/api/auth/user/query_by_username": {
|
"/api/auth/user/query_by_username": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "根据用户名查询用户",
|
"summary": "根据用户名查询用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
"/api/auth/user/query_by_uuid": {
|
"/api/auth/user/query_by_uuid": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "根据uuid查询用户",
|
"summary": "根据uuid查询用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -172,11 +172,11 @@
|
|||||||
},
|
},
|
||||||
"/api/captcha/shape/check": {
|
"/api/captcha/shape/check": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "验证点击形状验证码",
|
"description": "生成点击形状基础验证码",
|
||||||
"tags": [
|
"tags": [
|
||||||
"点击形状验证码"
|
"点击形状验证码"
|
||||||
],
|
],
|
||||||
"summary": "验证点击形状验证码",
|
"summary": "生成点击形状基础验证码",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
@@ -239,11 +239,11 @@
|
|||||||
},
|
},
|
||||||
"/api/captcha/shape/slide/region/get": {
|
"/api/captcha/shape/slide/region/get": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "验证点击形状验证码",
|
"description": "生成点击形状验证码",
|
||||||
"tags": [
|
"tags": [
|
||||||
"点击形状验证码"
|
"点击形状验证码"
|
||||||
],
|
],
|
||||||
"summary": "验证点击形状验证码",
|
"summary": "生成点击形状验证码",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
@@ -315,11 +315,14 @@
|
|||||||
},
|
},
|
||||||
"/api/oauth/callback_notify": {
|
"/api/oauth/callback_notify": {
|
||||||
"post": {
|
"post": {
|
||||||
"description": "微信回调验证",
|
"description": "微信回调",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"summary": "微信回调验证",
|
"tags": [
|
||||||
|
"微信公众号"
|
||||||
|
],
|
||||||
|
"summary": "微信回调",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -329,6 +332,9 @@
|
|||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"微信公众号"
|
||||||
|
],
|
||||||
"summary": "微信回调验证",
|
"summary": "微信回调验证",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
}
|
}
|
||||||
@@ -339,6 +345,9 @@
|
|||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"微信公众号"
|
||||||
|
],
|
||||||
"summary": "生成客户端ID",
|
"summary": "生成客户端ID",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
}
|
}
|
||||||
@@ -349,6 +358,9 @@
|
|||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"微信公众号"
|
||||||
|
],
|
||||||
"summary": "获取临时二维码",
|
"summary": "获取临时二维码",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -369,7 +381,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"OAuth"
|
"Gitee OAuth"
|
||||||
],
|
],
|
||||||
"summary": "处理Gitee回调",
|
"summary": "处理Gitee回调",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
@@ -382,7 +394,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"OAuth"
|
"Gitee OAuth"
|
||||||
],
|
],
|
||||||
"summary": "获取Gitee登录地址",
|
"summary": "获取Gitee登录地址",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -402,7 +414,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"OAuth"
|
"Github OAuth"
|
||||||
],
|
],
|
||||||
"summary": "登录回调函数",
|
"summary": "登录回调函数",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -431,7 +443,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"OAuth"
|
"Github OAuth"
|
||||||
],
|
],
|
||||||
"summary": "获取github登录url",
|
"summary": "获取github登录url",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -451,7 +463,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"登录"
|
"QQ OAuth"
|
||||||
],
|
],
|
||||||
"summary": "QQ登录回调",
|
"summary": "QQ登录回调",
|
||||||
"responses": {}
|
"responses": {}
|
||||||
@@ -464,7 +476,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"登录"
|
"QQ OAuth"
|
||||||
],
|
],
|
||||||
"summary": "获取QQ登录地址",
|
"summary": "获取QQ登录地址",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -501,7 +513,7 @@
|
|||||||
},
|
},
|
||||||
"/api/sms/smsbao/send": {
|
"/api/sms/smsbao/send": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "发送短信验证码",
|
"description": "短信宝发送短信验证码",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -546,7 +558,7 @@
|
|||||||
"/api/token/refresh": {
|
"/api/token/refresh": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "刷新token",
|
"summary": "刷新token",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -571,7 +583,7 @@
|
|||||||
"/api/user/add": {
|
"/api/user/add": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "添加用户",
|
"summary": "添加用户",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -598,7 +610,7 @@
|
|||||||
"/api/user/login": {
|
"/api/user/login": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "账号登录",
|
"summary": "账号登录",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -625,23 +637,18 @@
|
|||||||
"/api/user/phone_login": {
|
"/api/user/phone_login": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "手机号登录/注册",
|
"summary": "手机号登录/注册",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"description": "用户信息",
|
||||||
"description": "手机号",
|
"name": "user",
|
||||||
"name": "phone",
|
"in": "body",
|
||||||
"in": "query",
|
"required": true,
|
||||||
"required": true
|
"schema": {
|
||||||
},
|
"$ref": "#/definitions/dto.PhoneLoginRequest"
|
||||||
{
|
}
|
||||||
"type": "string",
|
|
||||||
"description": "验证码",
|
|
||||||
"name": "captcha",
|
|
||||||
"in": "query",
|
|
||||||
"required": true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -657,7 +664,7 @@
|
|||||||
"/api/user/reset_password": {
|
"/api/user/reset_password": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"鉴权模块"
|
"用户模块"
|
||||||
],
|
],
|
||||||
"summary": "重置密码",
|
"summary": "重置密码",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -680,6 +687,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/api/ws/gws": {
|
||||||
|
"get": {
|
||||||
|
"description": "创建websocket服务",
|
||||||
|
"tags": [
|
||||||
|
"websocket"
|
||||||
|
],
|
||||||
|
"summary": "创建websocket服务",
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/ws/socket": {
|
||||||
|
"get": {
|
||||||
|
"description": "创建websocket服务",
|
||||||
|
"tags": [
|
||||||
|
"websocket"
|
||||||
|
],
|
||||||
|
"summary": "创建websocket服务(gorilla)",
|
||||||
|
"responses": {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
@@ -689,6 +716,9 @@
|
|||||||
"account": {
|
"account": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"auto_login": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"password": {
|
"password": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -708,6 +738,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.PhoneLoginRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"auto_login": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"captcha": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phone": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.ResetPasswordRequest": {
|
"dto.ResetPasswordRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@@ -3,6 +3,8 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
account:
|
account:
|
||||||
type: string
|
type: string
|
||||||
|
auto_login:
|
||||||
|
type: boolean
|
||||||
password:
|
password:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
@@ -15,6 +17,15 @@ definitions:
|
|||||||
username:
|
username:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
dto.PhoneLoginRequest:
|
||||||
|
properties:
|
||||||
|
auto_login:
|
||||||
|
type: boolean
|
||||||
|
captcha:
|
||||||
|
type: string
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
dto.ResetPasswordRequest:
|
dto.ResetPasswordRequest:
|
||||||
properties:
|
properties:
|
||||||
captcha:
|
captcha:
|
||||||
@@ -38,7 +49,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 获取所有用户列表
|
summary: 获取所有用户列表
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/auth/user/delete:
|
/api/auth/user/delete:
|
||||||
delete:
|
delete:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -54,7 +65,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 删除用户
|
summary: 删除用户
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/auth/user/query_by_phone:
|
/api/auth/user/query_by_phone:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -70,7 +81,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 根据手机号查询用户
|
summary: 根据手机号查询用户
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/auth/user/query_by_username:
|
/api/auth/user/query_by_username:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -86,7 +97,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 根据用户名查询用户
|
summary: 根据用户名查询用户
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/auth/user/query_by_uuid:
|
/api/auth/user/query_by_uuid:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -102,7 +113,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 根据uuid查询用户
|
summary: 根据uuid查询用户
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/captcha/rotate/check:
|
/api/captcha/rotate/check:
|
||||||
post:
|
post:
|
||||||
description: 验证旋转验证码
|
description: 验证旋转验证码
|
||||||
@@ -138,13 +149,13 @@ paths:
|
|||||||
- 旋转验证码
|
- 旋转验证码
|
||||||
/api/captcha/shape/check:
|
/api/captcha/shape/check:
|
||||||
get:
|
get:
|
||||||
description: 验证点击形状验证码
|
description: 生成点击形状基础验证码
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
summary: 验证点击形状验证码
|
summary: 生成点击形状基础验证码
|
||||||
tags:
|
tags:
|
||||||
- 点击形状验证码
|
- 点击形状验证码
|
||||||
/api/captcha/shape/get:
|
/api/captcha/shape/get:
|
||||||
@@ -182,13 +193,13 @@ paths:
|
|||||||
- 点击形状验证码
|
- 点击形状验证码
|
||||||
/api/captcha/shape/slide/region/get:
|
/api/captcha/shape/slide/region/get:
|
||||||
get:
|
get:
|
||||||
description: 验证点击形状验证码
|
description: 生成点击形状验证码
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
summary: 验证点击形状验证码
|
summary: 生成点击形状验证码
|
||||||
tags:
|
tags:
|
||||||
- 点击形状验证码
|
- 点击形状验证码
|
||||||
/api/captcha/text/check:
|
/api/captcha/text/check:
|
||||||
@@ -232,11 +243,13 @@ paths:
|
|||||||
- 基础文字验证码
|
- 基础文字验证码
|
||||||
/api/oauth/callback_notify:
|
/api/oauth/callback_notify:
|
||||||
post:
|
post:
|
||||||
description: 微信回调验证
|
description: 微信回调
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses: {}
|
responses: {}
|
||||||
summary: 微信回调验证
|
summary: 微信回调
|
||||||
|
tags:
|
||||||
|
- 微信公众号
|
||||||
/api/oauth/callback_verify:
|
/api/oauth/callback_verify:
|
||||||
get:
|
get:
|
||||||
description: 微信回调验证
|
description: 微信回调验证
|
||||||
@@ -244,6 +257,8 @@ paths:
|
|||||||
- application/json
|
- application/json
|
||||||
responses: {}
|
responses: {}
|
||||||
summary: 微信回调验证
|
summary: 微信回调验证
|
||||||
|
tags:
|
||||||
|
- 微信公众号
|
||||||
/api/oauth/generate_client_id:
|
/api/oauth/generate_client_id:
|
||||||
get:
|
get:
|
||||||
description: 生成客户端ID
|
description: 生成客户端ID
|
||||||
@@ -251,6 +266,8 @@ paths:
|
|||||||
- application/json
|
- application/json
|
||||||
responses: {}
|
responses: {}
|
||||||
summary: 生成客户端ID
|
summary: 生成客户端ID
|
||||||
|
tags:
|
||||||
|
- 微信公众号
|
||||||
/api/oauth/get_temp_qrcode:
|
/api/oauth/get_temp_qrcode:
|
||||||
get:
|
get:
|
||||||
description: 获取临时二维码
|
description: 获取临时二维码
|
||||||
@@ -264,6 +281,8 @@ paths:
|
|||||||
- application/json
|
- application/json
|
||||||
responses: {}
|
responses: {}
|
||||||
summary: 获取临时二维码
|
summary: 获取临时二维码
|
||||||
|
tags:
|
||||||
|
- 微信公众号
|
||||||
/api/oauth/gitee/callback:
|
/api/oauth/gitee/callback:
|
||||||
get:
|
get:
|
||||||
description: 处理Gitee回调
|
description: 处理Gitee回调
|
||||||
@@ -272,7 +291,7 @@ paths:
|
|||||||
responses: {}
|
responses: {}
|
||||||
summary: 处理Gitee回调
|
summary: 处理Gitee回调
|
||||||
tags:
|
tags:
|
||||||
- OAuth
|
- Gitee OAuth
|
||||||
/api/oauth/gitee/get_url:
|
/api/oauth/gitee/get_url:
|
||||||
get:
|
get:
|
||||||
description: 获取Gitee登录地址
|
description: 获取Gitee登录地址
|
||||||
@@ -285,7 +304,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 获取Gitee登录地址
|
summary: 获取Gitee登录地址
|
||||||
tags:
|
tags:
|
||||||
- OAuth
|
- Gitee OAuth
|
||||||
/api/oauth/github/callback:
|
/api/oauth/github/callback:
|
||||||
get:
|
get:
|
||||||
description: 登录回调函数
|
description: 登录回调函数
|
||||||
@@ -304,7 +323,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 登录回调函数
|
summary: 登录回调函数
|
||||||
tags:
|
tags:
|
||||||
- OAuth
|
- Github OAuth
|
||||||
/api/oauth/github/get_url:
|
/api/oauth/github/get_url:
|
||||||
get:
|
get:
|
||||||
description: 获取github登录url
|
description: 获取github登录url
|
||||||
@@ -317,7 +336,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 获取github登录url
|
summary: 获取github登录url
|
||||||
tags:
|
tags:
|
||||||
- OAuth
|
- Github OAuth
|
||||||
/api/oauth/qq/callback:
|
/api/oauth/qq/callback:
|
||||||
get:
|
get:
|
||||||
description: QQ登录回调
|
description: QQ登录回调
|
||||||
@@ -326,7 +345,7 @@ paths:
|
|||||||
responses: {}
|
responses: {}
|
||||||
summary: QQ登录回调
|
summary: QQ登录回调
|
||||||
tags:
|
tags:
|
||||||
- 登录
|
- QQ OAuth
|
||||||
/api/oauth/qq/get_url:
|
/api/oauth/qq/get_url:
|
||||||
get:
|
get:
|
||||||
description: 获取QQ登录地址
|
description: 获取QQ登录地址
|
||||||
@@ -339,7 +358,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 获取QQ登录地址
|
summary: 获取QQ登录地址
|
||||||
tags:
|
tags:
|
||||||
- 登录
|
- QQ OAuth
|
||||||
/api/sms/ali/send:
|
/api/sms/ali/send:
|
||||||
get:
|
get:
|
||||||
description: 发送短信验证码
|
description: 发送短信验证码
|
||||||
@@ -357,7 +376,7 @@ paths:
|
|||||||
- 短信验证码
|
- 短信验证码
|
||||||
/api/sms/smsbao/send:
|
/api/sms/smsbao/send:
|
||||||
get:
|
get:
|
||||||
description: 发送短信验证码
|
description: 短信宝发送短信验证码
|
||||||
parameters:
|
parameters:
|
||||||
- description: 手机号
|
- description: 手机号
|
||||||
in: query
|
in: query
|
||||||
@@ -400,7 +419,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 刷新token
|
summary: 刷新token
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/user/add:
|
/api/user/add:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -417,7 +436,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 添加用户
|
summary: 添加用户
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/user/login:
|
/api/user/login:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -434,20 +453,16 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 账号登录
|
summary: 账号登录
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/user/phone_login:
|
/api/user/phone_login:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
- description: 手机号
|
- description: 用户信息
|
||||||
in: query
|
in: body
|
||||||
name: phone
|
name: user
|
||||||
required: true
|
required: true
|
||||||
type: string
|
schema:
|
||||||
- description: 验证码
|
$ref: '#/definitions/dto.PhoneLoginRequest'
|
||||||
in: query
|
|
||||||
name: captcha
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
@@ -455,7 +470,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 手机号登录/注册
|
summary: 手机号登录/注册
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
/api/user/reset_password:
|
/api/user/reset_password:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -472,5 +487,19 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 重置密码
|
summary: 重置密码
|
||||||
tags:
|
tags:
|
||||||
- 鉴权模块
|
- 用户模块
|
||||||
|
/api/ws/gws:
|
||||||
|
get:
|
||||||
|
description: 创建websocket服务
|
||||||
|
responses: {}
|
||||||
|
summary: 创建websocket服务
|
||||||
|
tags:
|
||||||
|
- websocket
|
||||||
|
/api/ws/socket:
|
||||||
|
get:
|
||||||
|
description: 创建websocket服务
|
||||||
|
responses: {}
|
||||||
|
summary: 创建websocket服务(gorilla)
|
||||||
|
tags:
|
||||||
|
- websocket
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
|
@@ -5,9 +5,15 @@ import (
|
|||||||
swaggerFiles "github.com/swaggo/files"
|
swaggerFiles "github.com/swaggo/files"
|
||||||
ginSwagger "github.com/swaggo/gin-swagger"
|
ginSwagger "github.com/swaggo/gin-swagger"
|
||||||
"schisandra-cloud-album/docs"
|
"schisandra-cloud-album/docs"
|
||||||
|
"schisandra-cloud-album/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SwaggerRouter(router *gin.Engine) {
|
func SwaggerRouter(router *gin.Engine) {
|
||||||
docs.SwaggerInfo.BasePath = ""
|
docs.SwaggerInfo.BasePath = ""
|
||||||
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
docs.SwaggerInfo.Description = global.CONFIG.Swagger.Description
|
||||||
|
router.GET("/api/doc/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, func(config *ginSwagger.Config) {
|
||||||
|
config.Title = global.CONFIG.Swagger.Title
|
||||||
|
}), gin.BasicAuth(gin.Accounts{
|
||||||
|
global.CONFIG.Swagger.User: global.CONFIG.Swagger.Password,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user