feat: 已发布帖子编辑后进修订审核,通过前保持展示旧内容

- Post 模型新增 PendingTitle/PendingBody 字段,分离已发布内容与待审修订
- Update: approved 帖子编辑写入 Pending 字段,不覆盖正文,不改变发布状态
- Approve: 有 PendingBody 时复制到正式字段后清空,无 PendingBody 走首次审核
- Reject: 有 PendingBody 时仅清空待审修订(保持已发布),无 PendingBody 走普通退回
- 新增 ListPendingRevisions 查询,管理后台独立展示"修订待审核"区域
- 详情页展示"修订审核中"标识,编辑页加载待审内容
- 通过修订后直接覆盖,不保留历史版本
This commit is contained in:
2026-05-30 20:24:43 +08:00
parent 89fa50a013
commit eabc1e7d3d
11 changed files with 124 additions and 9 deletions

View File

@ -31,7 +31,7 @@ type userAdminStore interface {
IncrementTokenVersion(userID uint) error
}
// postStore PostService 所需的最小仓储接口ISP9 个方法)
// postStore PostService 所需的最小仓储接口ISP10 个方法)
type postStore interface {
Create(post *model.Post) error
FindByID(id uint) (*model.Post, error)
@ -39,6 +39,7 @@ type postStore interface {
FindPageable(keyword string, offset, limit int) ([]model.Post, int64, error)
FindAdminPageable(keyword, status string, offset, limit int) ([]model.Post, int64, error)
FindByUserIDAndStatus(userID uint, status string, offset, limit int) ([]model.Post, int64, error)
FindPendingRevisions(keyword string, offset, limit int) ([]model.Post, int64, error)
Update(post *model.Post) error
SoftDelete(id uint) error
Restore(id uint) error