This commit is contained in:
2026-08-14 16:34:17 +08:00
parent e0b0e1d8c8
commit f63acae353
53 changed files with 2488 additions and 350 deletions
+5 -1
View File
@@ -83,7 +83,11 @@ func (h *Media) DeleteMany(c *gin.Context) {
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "批量删除成功")
}
func (h *Media) Find(c *gin.Context) {
id, _ := strconv.ParseUint(c.Query("id"), 10, 64)
id, parseErr := strconv.ParseUint(c.Query("id"), 10, 64)
if parseErr != nil {
httpx.Fail(c, "文件ID非法")
return
}
item, err := h.service.Media(c.Request.Context(), uint(id))
if err != nil {
httpx.Fail(c, "查询失败")
+7 -1
View File
@@ -100,7 +100,13 @@ func (h *Public) Login(c *gin.Context) {
if err != nil {
_, _ = h.system.CacheIncrement(c.Request.Context(), c.ClientIP(), ipTTL)
if errors.Is(err, biz.ErrUserDisabled) {
_ = h.audit.RecordLoginRequest(c.Request.Context(), &dto.LoginLogRequest{Username: req.Username, IP: c.ClientIP(), Status: false, ErrorMessage: "用户被禁止登录", Agent: c.Request.UserAgent()})
var disabled *service.UserDisabledError
errors.As(err, &disabled)
userID := uint(0)
if disabled != nil {
userID = disabled.UserID
}
_ = h.audit.RecordLoginRequest(c.Request.Context(), &dto.LoginLogRequest{Username: req.Username, IP: c.ClientIP(), Status: false, ErrorMessage: "用户被禁止登录", Agent: c.Request.UserAgent(), UserID: userID})
httpx.Fail(c, "用户被禁止登录")
return
}