feat: add batch content governance actions

This commit is contained in:
2026-01-16 14:19:43 +08:00
parent e5f40287c3
commit daaacc3fa4
11 changed files with 431 additions and 3 deletions

View File

@@ -116,3 +116,19 @@ func (c *contents) Review(ctx fiber.Ctx, user *models.User, id int64, form *dto.
func (c *contents) BatchReview(ctx fiber.Ctx, user *models.User, form *dto.SuperContentBatchReviewForm) error {
return services.Super.BatchReviewContents(ctx, user.ID, form)
}
// Batch update content status
//
// @Router /super/v1/contents/status/batch [post]
// @Summary Batch update content status
// @Description Batch unpublish or block contents
// @Tags Content
// @Accept json
// @Produce json
// @Param form body dto.SuperContentBatchStatusForm true "Batch status form"
// @Success 200 {string} string "Updated"
// @Bind user local key(__ctx_user)
// @Bind form body
func (c *contents) BatchUpdateStatus(ctx fiber.Ctx, user *models.User, form *dto.SuperContentBatchStatusForm) error {
return services.Super.BatchUpdateContentStatus(ctx, user.ID, form)
}

View File

@@ -446,6 +446,15 @@ type SuperContentBatchReviewForm struct {
Reason string `json:"reason"`
}
type SuperContentBatchStatusForm struct {
// ContentIDs 待处置内容ID列表。
ContentIDs []int64 `json:"content_ids" validate:"required,min=1,dive,gt=0"`
// Status 目标内容状态unpublished/blocked
Status consts.ContentStatus `json:"status" validate:"required,oneof=unpublished blocked"`
// Reason 处置说明(可选,用于审计与通知作者)。
Reason string `json:"reason"`
}
type SuperTenantUserItem struct {
// User 用户信息。
User *SuperUserLite `json:"user"`

View File

@@ -145,6 +145,12 @@ func (r *Routes) Register(router fiber.Router) {
Local[*models.User]("__ctx_user"),
Body[dto.SuperContentBatchReviewForm]("form"),
))
r.log.Debugf("Registering route: Post /super/v1/contents/status/batch -> contents.BatchUpdateStatus")
router.Post("/super/v1/contents/status/batch"[len(r.Path()):], Func2(
r.contents.BatchUpdateStatus,
Local[*models.User]("__ctx_user"),
Body[dto.SuperContentBatchStatusForm]("form"),
))
// Register routes for controller: coupons
r.log.Debugf("Registering route: Get /super/v1/coupon-grants -> coupons.ListGrants")
router.Get("/super/v1/coupon-grants"[len(r.Path()):], DataFunc1(