This commit is contained in:
2026-08-16 09:02:39 +08:00
parent c554152f4f
commit f7f6db8695
105 changed files with 2535 additions and 948 deletions
+12 -4
View File
@@ -53,8 +53,16 @@ func (h *Public) Captcha(c *gin.Context) {
func (h *Public) Login(c *gin.Context) {
var req dto.LoginRequest
if c.ShouldBindJSON(&req) != nil || req.Username == "" || req.Password == "" {
httpx.Fail(c, "请输入用户名和密码")
if err := c.ShouldBindJSON(&req); err != nil {
httpx.Fail(c, err.Error())
return
}
if req.Username == "" {
httpx.Fail(c, "Username值不能为空")
return
}
if req.Password == "" {
httpx.Fail(c, "Password值不能为空")
return
}
result, err := h.auth.Login(c.Request.Context(), &req, c.ClientIP(), c.Request.UserAgent())
@@ -109,12 +117,12 @@ func (h *Public) InitializeDatabase(engine *gin.Engine) gin.HandlerFunc {
return
}
if initialized {
httpx.Fail(c, "数据库已初始化,无需重复初始化")
httpx.Fail(c, "已存在数据库配置")
return
}
var input service.DatabaseInit
if c.ShouldBindJSON(&input) != nil {
httpx.Fail(c, "数据库初始化参数无效")
httpx.Fail(c, "参数校验不通过")
return
}
routes := engine.Routes()