2022-05-18 17:57:03 +08:00
|
|
|
package controller
|
|
|
|
|
|
|
|
import (
|
2022-05-29 10:06:21 +08:00
|
|
|
"github.com/eryajf/go-ldap-admin/logic"
|
2022-06-14 11:17:38 +08:00
|
|
|
"github.com/eryajf/go-ldap-admin/model/request"
|
2022-05-18 17:57:03 +08:00
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
type BaseController struct{}
|
|
|
|
|
2023-03-09 11:41:33 +08:00
|
|
|
// SendCode 给用户邮箱发送验证码
|
|
|
|
func (m *BaseController) SendCode(c *gin.Context) {
|
|
|
|
req := new(request.BaseSendCodeReq)
|
|
|
|
Run(c, req, func() (interface{}, interface{}) {
|
|
|
|
return logic.Base.SendCode(c, req)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-05-18 17:57:03 +08:00
|
|
|
// ChangePwd 用户通过邮箱修改密码
|
|
|
|
func (m *BaseController) ChangePwd(c *gin.Context) {
|
|
|
|
req := new(request.BaseChangePwdReq)
|
|
|
|
Run(c, req, func() (interface{}, interface{}) {
|
|
|
|
return logic.Base.ChangePwd(c, req)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dashboard 系统首页展示数据
|
|
|
|
func (m *BaseController) Dashboard(c *gin.Context) {
|
|
|
|
req := new(request.BaseDashboardReq)
|
|
|
|
Run(c, req, func() (interface{}, interface{}) {
|
|
|
|
return logic.Base.Dashboard(c, req)
|
|
|
|
})
|
|
|
|
}
|
2022-07-05 12:16:05 +08:00
|
|
|
|
2023-02-14 11:23:08 +08:00
|
|
|
// EncryptPasswd 生成加密密码
|
|
|
|
func (m *BaseController) EncryptPasswd(c *gin.Context) {
|
|
|
|
req := new(request.EncryptPasswdReq)
|
2022-07-05 12:16:05 +08:00
|
|
|
Run(c, req, func() (interface{}, interface{}) {
|
2023-02-14 11:23:08 +08:00
|
|
|
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)
|
2022-07-05 12:16:05 +08:00
|
|
|
})
|
|
|
|
}
|