feat: add tenant content management features for superadmin

- Implemented API endpoints for listing tenant contents and updating content status.
- Added Swagger documentation for new endpoints:
  - GET /super/v1/tenants/{tenantID}/contents
  - PATCH /super/v1/tenants/{tenantID}/contents/{contentID}/status
- Created DTOs for content item and status update form.
- Enhanced frontend to support content management in the tenant detail page.
- Added search and filter functionalities for tenant contents.
- Implemented unpublish functionality with confirmation dialog.
- Updated service layer to handle new content management logic.
This commit is contained in:
2025-12-24 16:10:07 +08:00
parent 8fa321dbf6
commit 568f5cda43
13 changed files with 1344 additions and 3 deletions

View File

@@ -704,6 +704,31 @@ definitions:
description: Reason is the human-readable refund reason used for audit.
type: string
type: object
dto.SuperTenantContentItem:
properties:
content:
$ref: '#/definitions/models.Content'
owner:
$ref: '#/definitions/dto.SuperUserLite'
price:
$ref: '#/definitions/models.ContentPrice'
status_description:
type: string
visibility_description:
type: string
type: object
dto.SuperTenantContentStatusUpdateForm:
properties:
status:
allOf:
- $ref: '#/definitions/consts.ContentStatus'
description: 'Status supports: unpublished (下架) / blocked (封禁)'
enum:
- unpublished
- blocked
required:
- status
type: object
dto.SuperTenantUserItem:
properties:
tenant_user:
@@ -1835,6 +1860,127 @@ paths:
summary: 更新过期时间
tags:
- Super
/super/v1/tenants/{tenantID}/contents:
get:
consumes:
- application/json
parameters:
- description: TenantID
format: int64
in: path
name: tenantID
required: true
type: integer
- description: Asc specifies comma-separated field names to sort ascending by.
in: query
name: asc
type: string
- in: query
name: created_at_from
type: string
- in: query
name: created_at_to
type: string
- description: Desc specifies comma-separated field names to sort descending
by.
in: query
name: desc
type: string
- in: query
name: keyword
type: string
- description: Limit is page size; only values in {10,20,50,100} are accepted
(otherwise defaults to 10).
in: query
name: limit
type: integer
- description: Page is 1-based page index; values <= 0 are normalized to 1.
in: query
name: page
type: integer
- in: query
name: published_at_from
type: string
- in: query
name: published_at_to
type: string
- enum:
- draft
- reviewing
- published
- unpublished
- blocked
in: query
name: status
type: string
x-enum-varnames:
- ContentStatusDraft
- ContentStatusReviewing
- ContentStatusPublished
- ContentStatusUnpublished
- ContentStatusBlocked
- in: query
name: user_id
type: integer
- enum:
- public
- tenant_only
- private
in: query
name: visibility
type: string
x-enum-varnames:
- ContentVisibilityPublic
- ContentVisibilityTenantOnly
- ContentVisibilityPrivate
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/requests.Pager'
- properties:
items:
$ref: '#/definitions/dto.SuperTenantContentItem'
type: object
summary: 租户内容列表(平台侧)
tags:
- Super
/super/v1/tenants/{tenantID}/contents/{contentID}/status:
patch:
consumes:
- application/json
parameters:
- description: TenantID
format: int64
in: path
name: tenantID
required: true
type: integer
- description: ContentID
format: int64
in: path
name: contentID
required: true
type: integer
- description: Form
in: body
name: form
required: true
schema:
$ref: '#/definitions/dto.SuperTenantContentStatusUpdateForm'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Content'
summary: 更新租户内容状态(平台侧:下架/封禁)
tags:
- Super
/super/v1/tenants/{tenantID}/status:
patch:
consumes: