fix_content (#150)
Co-authored-by: eryajf <eryajf@users.noreply.github.com>
This commit is contained in:
parent
4bde323b90
commit
c6c7fc48c8
|
@ -31,7 +31,6 @@
|
||||||
- [🔗 文档快链](#-%E6%96%87%E6%A1%A3%E5%BF%AB%E9%93%BE)
|
- [🔗 文档快链](#-%E6%96%87%E6%A1%A3%E5%BF%AB%E9%93%BE)
|
||||||
- [🥰 感谢](#-%E6%84%9F%E8%B0%A2)
|
- [🥰 感谢](#-%E6%84%9F%E8%B0%A2)
|
||||||
- [🤗 另外](#-%E5%8F%A6%E5%A4%96)
|
- [🤗 另外](#-%E5%8F%A6%E5%A4%96)
|
||||||
- [⚡ 加群](#-%E5%8A%A0%E7%BE%A4)
|
|
||||||
- [🤑 捐赠](#-%E6%8D%90%E8%B5%A0)
|
- [🤑 捐赠](#-%E6%8D%90%E8%B5%A0)
|
||||||
- [📝 使用登记](#-%E4%BD%BF%E7%94%A8%E7%99%BB%E8%AE%B0)
|
- [📝 使用登记](#-%E4%BD%BF%E7%94%A8%E7%99%BB%E8%AE%B0)
|
||||||
- [💎 优秀软件推荐](#-%E4%BC%98%E7%A7%80%E8%BD%AF%E4%BB%B6%E6%8E%A8%E8%8D%90)
|
- [💎 优秀软件推荐](#-%E4%BC%98%E7%A7%80%E8%BD%AF%E4%BB%B6%E6%8E%A8%E8%8D%90)
|
||||||
|
@ -96,12 +95,6 @@
|
||||||
|
|
||||||
- 如果觉得项目不错,麻烦动动小手点个⭐️star⭐️!
|
- 如果觉得项目不错,麻烦动动小手点个⭐️star⭐️!
|
||||||
- 如果你还有其他想法或者需求,欢迎在issue中交流!
|
- 如果你还有其他想法或者需求,欢迎在issue中交流!
|
||||||
- 程序还有很多bug,欢迎各位朋友一起协同共建!
|
|
||||||
|
|
||||||
|
|
||||||
## ⚡ 加群
|
|
||||||
|
|
||||||
如果想要加群交流,可通过搜索 cWN3ZDg4NDgK (base64)添加我的微信,备注 ldap 拉你进群。
|
|
||||||
|
|
||||||
## 🤑 捐赠
|
## 🤑 捐赠
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,18 @@ func (m *BaseController) Dashboard(c *gin.Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPasswd 生成加密密码
|
// EncryptPasswd 生成加密密码
|
||||||
func (m *BaseController) GetPasswd(c *gin.Context) {
|
func (m *BaseController) EncryptPasswd(c *gin.Context) {
|
||||||
req := new(request.GetPasswdReq)
|
req := new(request.EncryptPasswdReq)
|
||||||
Run(c, req, func() (interface{}, interface{}) {
|
Run(c, req, func() (interface{}, interface{}) {
|
||||||
return logic.Base.GetPasswd(c, req)
|
return logic.Base.EncryptPasswd(c, req)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// DecryptPasswd 密码解密为明文
|
||||||
|
func (m *BaseController) DecryptPasswd(c *gin.Context) {
|
||||||
|
req := new(request.DecryptPasswdReq)
|
||||||
|
Run(c, req, func() (interface{}, interface{}) {
|
||||||
|
return logic.Base.DecryptPasswd(c, req)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,9 +136,9 @@ func (l BaseLogic) Dashboard(c *gin.Context, req interface{}) (data interface{},
|
||||||
return rst, nil
|
return rst, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPasswd
|
// EncryptPasswd
|
||||||
func (l BaseLogic) GetPasswd(c *gin.Context, req interface{}) (data interface{}, rspError interface{}) {
|
func (l BaseLogic) EncryptPasswd(c *gin.Context, req interface{}) (data interface{}, rspError interface{}) {
|
||||||
r, ok := req.(*request.GetPasswdReq)
|
r, ok := req.(*request.EncryptPasswdReq)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, ReqAssertErr
|
return nil, ReqAssertErr
|
||||||
}
|
}
|
||||||
|
@ -146,3 +146,14 @@ func (l BaseLogic) GetPasswd(c *gin.Context, req interface{}) (data interface{},
|
||||||
|
|
||||||
return tools.NewGenPasswd(r.Passwd), nil
|
return tools.NewGenPasswd(r.Passwd), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DecryptPasswd
|
||||||
|
func (l BaseLogic) DecryptPasswd(c *gin.Context, req interface{}) (data interface{}, rspError interface{}) {
|
||||||
|
r, ok := req.(*request.DecryptPasswdReq)
|
||||||
|
if !ok {
|
||||||
|
return nil, ReqAssertErr
|
||||||
|
}
|
||||||
|
_ = c
|
||||||
|
|
||||||
|
return tools.NewParPasswd(r.Passwd), nil
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,12 @@ type BaseChangePwdReq struct {
|
||||||
type BaseDashboardReq struct {
|
type BaseDashboardReq struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPasswdReq
|
// EncryptPasswdReq
|
||||||
type GetPasswdReq struct {
|
type EncryptPasswdReq struct {
|
||||||
|
Passwd string `json:"passwd" form:"passwd" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DecryptPasswdReq
|
||||||
|
type DecryptPasswdReq struct {
|
||||||
Passwd string `json:"passwd" form:"passwd" validate:"required"`
|
Passwd string `json:"passwd" form:"passwd" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ func InitBaseRoutes(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) gi
|
||||||
base := r.Group("/base")
|
base := r.Group("/base")
|
||||||
{
|
{
|
||||||
base.GET("ping", controller.Demo)
|
base.GET("ping", controller.Demo)
|
||||||
base.GET("getpasswd", controller.Base.GetPasswd) // 将明文字符串转为MySQL识别的密码
|
base.GET("encryptpwd", controller.Base.EncryptPasswd) // 生成加密密码
|
||||||
|
base.GET("decryptpwd", controller.Base.DecryptPasswd) // 密码解密为明文
|
||||||
// 登录登出刷新token无需鉴权
|
// 登录登出刷新token无需鉴权
|
||||||
base.POST("/login", authMiddleware.LoginHandler)
|
base.POST("/login", authMiddleware.LoginHandler)
|
||||||
base.POST("/logout", authMiddleware.LogoutHandler)
|
base.POST("/logout", authMiddleware.LogoutHandler)
|
||||||
|
|
Loading…
Reference in New Issue