更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

-21
View File
@@ -17,7 +17,6 @@ type platformLoginRequest struct {
Account string `json:"account"`
Password string `json:"password"`
Code string `json:"code"`
// 极验4验证参数
CaptchaID string `json:"captcha_id"`
LotNumber string `json:"lot_number"`
PassToken string `json:"pass_token"`
@@ -32,19 +31,15 @@ type backendLoginRequest struct {
Code string `json:"code"`
}
// PlatformAuthController 平台端认证控制器
type PlatformAuthController struct {
beego.Controller
}
// LoginPlatform 平台端登录(不需要租户)
func (c *PlatformAuthController) LoginPlatform() {
var req platformLoginRequest
// 先尝试从缓存读取
body := c.Ctx.Input.RequestBody
// 如果缓存为空,直接从请求体读取
if len(body) == 0 {
var err error
body, err = io.ReadAll(c.Ctx.Request.Body)
@@ -95,7 +90,6 @@ func (c *PlatformAuthController) LoginPlatform() {
cfg, _ := models.GetPlatformLoginVerify()
if cfg.OpenVerifyEnabled == 1 {
// 极验验证
if cfg.VerifyType == "geetest4" {
if req.LotNumber == "" || req.PassToken == "" || req.GenTime == "" || req.CaptchaOutput == "" {
c.Data["json"] = map[string]interface{}{"code": 400, "msg": "请完成人机验证"}
@@ -103,9 +97,7 @@ func (c *PlatformAuthController) LoginPlatform() {
return
}
// TODO: 这里应该调用极验服务端SDK验证,暂时跳过验证
// 如果需要严格验证,需要集成极验服务端SDK
} else if cfg.VerifyType == "geetest3" {
// 极验3验证
if req.CaptchaOutput == "" {
c.Data["json"] = map[string]interface{}{"code": 400, "msg": "请完成人机验证"}
_ = c.ServeJSON()
@@ -126,7 +118,6 @@ func (c *PlatformAuthController) LoginPlatform() {
}
}
// 控制器只做 HTTP 解析与响应编排,业务逻辑放 services 层
token, loginUser, err := services.PlatformAdminLogin(req.Account, req.Password, c.Ctx.Input.IP())
if err != nil {
RecordLoginLog(nil, 0, req.Account, "", "", "password", 0, err.Error(), c.Ctx.Input.IP(), c.Ctx.Request.UserAgent())
@@ -158,7 +149,6 @@ func (c *PlatformAuthController) LoginPlatform() {
_ = c.ServeJSON()
}
// LoginBackend backend 登录(需要租户)
func (c *PlatformAuthController) LoginBackend() {
var req backendLoginRequest
@@ -220,7 +210,6 @@ func (c *PlatformAuthController) LoginBackend() {
_ = c.ServeJSON()
}
// GetCurrentUser 当前登录平台用户信息(含角色名称),需 Bearer Token
func (c *PlatformAuthController) GetCurrentUser() {
claims, err := identity.Claims(c.Ctx.Request.Header.Get("Authorization"), identity.EndPlatform)
if err != nil {
@@ -250,7 +239,6 @@ func (c *PlatformAuthController) GetCurrentUser() {
_ = c.ServeJSON()
}
// SendLoginCode 发送登录验证码(占位实现)
func (c *PlatformAuthController) SendLoginCode() {
var req struct {
Account string `json:"account"`
@@ -294,7 +282,6 @@ func (c *PlatformAuthController) SendLoginCode() {
_ = c.ServeJSON()
}
// LoginBySms 手机号验证码登录(占位实现)
func (c *PlatformAuthController) LoginBySms() {
c.Data["json"] = map[string]interface{}{
"code": 501,
@@ -303,7 +290,6 @@ func (c *PlatformAuthController) LoginBySms() {
_ = c.ServeJSON()
}
// Logout 平台退出登录(占位实现,当前为无状态直接返回成功)
func (c *PlatformAuthController) Logout() {
c.Data["json"] = map[string]interface{}{
"code": 200,
@@ -312,7 +298,6 @@ func (c *PlatformAuthController) Logout() {
_ = c.ServeJSON()
}
// GetGeetest3Infos 获取极验3.0配置(占位实现)
func (c *PlatformAuthController) GetGeetest3Infos() {
cfg, _ := models.GetPlatformLoginVerify()
if cfg.Geetest3ID == nil || cfg.Geetest3Key == nil {
@@ -331,7 +316,6 @@ func (c *PlatformAuthController) GetGeetest3Infos() {
_ = c.ServeJSON()
}
// GetGeetest4Infos 获取极验4.0配置(占位实现)
func (c *PlatformAuthController) GetGeetest4Infos() {
cfg, _ := models.GetPlatformLoginVerify()
if cfg.Geetest4ID == nil || cfg.Geetest4Key == nil {
@@ -350,7 +334,6 @@ func (c *PlatformAuthController) GetGeetest4Infos() {
_ = c.ServeJSON()
}
// GetOpenVerify 判断是否开启登录验证(占位实现)
func (c *PlatformAuthController) GetOpenVerify() {
cfg, _ := models.GetPlatformLoginVerify()
openVerify := "0"
@@ -374,7 +357,6 @@ func (c *PlatformAuthController) GetOpenVerify() {
_ = c.ServeJSON()
}
// Register 注册(占位实现)
func (c *PlatformAuthController) Register() {
c.Data["json"] = map[string]interface{}{
"code": 501,
@@ -383,7 +365,6 @@ func (c *PlatformAuthController) Register() {
_ = c.ServeJSON()
}
// SendRegisterCode 发送注册验证码(占位实现)
func (c *PlatformAuthController) SendRegisterCode() {
c.Data["json"] = map[string]interface{}{
"code": 501,
@@ -392,7 +373,6 @@ func (c *PlatformAuthController) SendRegisterCode() {
_ = c.ServeJSON()
}
// ResetPassword 忘记密码重置(占位实现)
func (c *PlatformAuthController) ResetPassword() {
c.Data["json"] = map[string]interface{}{
"code": 501,
@@ -401,7 +381,6 @@ func (c *PlatformAuthController) ResetPassword() {
_ = c.ServeJSON()
}
// SendResetCode 发送找回密码验证码(占位实现)
func (c *PlatformAuthController) SendResetCode() {
c.Data["json"] = map[string]interface{}{
"code": 501,