From a806532d252b53a6df43b548761cfcf97073c243 Mon Sep 17 00:00:00 2001 From: Victor_Jay Date: Tue, 2 Jun 2026 22:31:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=94=81=E5=AE=9A=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E9=9A=8F=E6=97=B6=E5=8F=AF=E7=94=A8=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E8=81=94=E5=8A=A8=E5=AE=A1=E6=A0=B8=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 前端:锁定按钮仅受 IsLocked 控制,移除 status!=pending 的条件 - 后端:Lock 方法移除 pending 状态的阻止,锁定状态独立 --- internal/service/post_audit_service.go | 5 +---- templates/admin/html/posts/index.html | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/service/post_audit_service.go b/internal/service/post_audit_service.go index 751e2cf..ac592b9 100644 --- a/internal/service/post_audit_service.go +++ b/internal/service/post_audit_service.go @@ -155,15 +155,12 @@ func (s *PostService) Reject(postID uint, reason string) error { } // Lock 锁定:设置 IsLocked 标志,禁止编辑,不改变帖子发布状态 +// 锁定状态独立于审核状态,任何状态的帖子均可锁定 func (s *PostService) Lock(postID uint, reason string) error { post, err := s.findPost(postID) if err != nil { return err } - // 待审核帖子不允许锁定(审核流程中) - if post.Status == model.PostStatusPending { - return common.ErrPostCannotLock - } post.IsLocked = true post.LockReason = reason return s.repo.Update(post) diff --git a/templates/admin/html/posts/index.html b/templates/admin/html/posts/index.html index 45b131f..edb1668 100644 --- a/templates/admin/html/posts/index.html +++ b/templates/admin/html/posts/index.html @@ -57,7 +57,7 @@ {{end}} - {{if and (not .IsLocked) (ne .Status "pending")}} + {{if not .IsLocked}} {{end}} {{if .IsLocked}}