feat: add superadmin user library detail
This commit is contained in:
@@ -151,3 +151,68 @@ type SuperUserContentActionItem struct {
|
||||
// Content 互动对应内容详情(含租户与作者信息)。
|
||||
Content *AdminContentItem `json:"content"`
|
||||
}
|
||||
|
||||
// SuperUserLibraryListFilter 超管用户内容消费列表过滤条件。
|
||||
type SuperUserLibraryListFilter struct {
|
||||
requests.Pagination
|
||||
// TenantID 内容所属租户ID,精确匹配。
|
||||
TenantID *int64 `query:"tenant_id"`
|
||||
// TenantCode 租户编码,模糊匹配。
|
||||
TenantCode *string `query:"tenant_code"`
|
||||
// TenantName 租户名称,模糊匹配。
|
||||
TenantName *string `query:"tenant_name"`
|
||||
// ContentID 内容ID,精确匹配。
|
||||
ContentID *int64 `query:"content_id"`
|
||||
// Keyword 内容标题/摘要/描述关键字,模糊匹配。
|
||||
Keyword *string `query:"keyword"`
|
||||
// Status 内容访问状态过滤(active/revoked/expired)。
|
||||
Status *consts.ContentAccessStatus `query:"status"`
|
||||
// OrderID 订单ID,精确匹配。
|
||||
OrderID *int64 `query:"order_id"`
|
||||
// OrderStatus 订单状态过滤。
|
||||
OrderStatus *consts.OrderStatus `query:"order_status"`
|
||||
// PaidAtFrom 支付时间起始(RFC3339)。
|
||||
PaidAtFrom *string `query:"paid_at_from"`
|
||||
// PaidAtTo 支付时间结束(RFC3339)。
|
||||
PaidAtTo *string `query:"paid_at_to"`
|
||||
// AccessedAtFrom 获取访问权限时间起始(RFC3339)。
|
||||
AccessedAtFrom *string `query:"accessed_at_from"`
|
||||
// AccessedAtTo 获取访问权限时间结束(RFC3339)。
|
||||
AccessedAtTo *string `query:"accessed_at_to"`
|
||||
// Asc 升序字段(id/created_at)。
|
||||
Asc *string `query:"asc"`
|
||||
// Desc 降序字段(id/created_at)。
|
||||
Desc *string `query:"desc"`
|
||||
}
|
||||
|
||||
// SuperUserLibraryItem 超管用户内容消费条目。
|
||||
type SuperUserLibraryItem struct {
|
||||
// AccessID 访问记录ID。
|
||||
AccessID int64 `json:"access_id"`
|
||||
// TenantID 内容所属租户ID。
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
// ContentID 内容ID。
|
||||
ContentID int64 `json:"content_id"`
|
||||
// OrderID 订单ID。
|
||||
OrderID int64 `json:"order_id"`
|
||||
// OrderType 订单类型。
|
||||
OrderType consts.OrderType `json:"order_type"`
|
||||
// OrderStatus 订单状态。
|
||||
OrderStatus consts.OrderStatus `json:"order_status"`
|
||||
// OrderStatusDescription 订单状态描述(用于展示)。
|
||||
OrderStatusDescription string `json:"order_status_description"`
|
||||
// AmountPaid 该内容实付金额(分)。
|
||||
AmountPaid int64 `json:"amount_paid"`
|
||||
// PaidAt 支付时间(RFC3339)。
|
||||
PaidAt string `json:"paid_at"`
|
||||
// AccessStatus 访问状态。
|
||||
AccessStatus consts.ContentAccessStatus `json:"access_status"`
|
||||
// AccessStatusDescription 访问状态描述(用于展示)。
|
||||
AccessStatusDescription string `json:"access_status_description"`
|
||||
// AccessedAt 获取访问权限时间(RFC3339)。
|
||||
AccessedAt string `json:"accessed_at"`
|
||||
// Content 内容详情(含租户/作者/价格)。
|
||||
Content *AdminContentItem `json:"content"`
|
||||
// Snapshot 下单快照(内容标题/金额等)。
|
||||
Snapshot any `json:"snapshot"`
|
||||
}
|
||||
|
||||
@@ -328,6 +328,12 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
PathParam[int64]("id"),
|
||||
Query[dto.SuperUserTenantListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/library -> users.ListLibrary")
|
||||
router.Get("/super/v1/users/:id<int>/library"[len(r.Path()):], DataFunc2(
|
||||
r.users.ListLibrary,
|
||||
PathParam[int64]("id"),
|
||||
Query[dto.SuperUserLibraryListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/likes -> users.ListLikes")
|
||||
router.Get("/super/v1/users/:id<int>/likes"[len(r.Path()):], DataFunc2(
|
||||
r.users.ListLikes,
|
||||
|
||||
@@ -127,6 +127,24 @@ func (c *users) ListTenants(ctx fiber.Ctx, id int64, filter *dto.SuperUserTenant
|
||||
return services.Super.ListUserTenants(ctx, id, filter)
|
||||
}
|
||||
|
||||
// List user library
|
||||
//
|
||||
// @Router /super/v1/users/:id<int>/library [get]
|
||||
// @Summary List user library
|
||||
// @Description List purchased contents of a user
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "User ID"
|
||||
// @Param page query int false "Page number"
|
||||
// @Param limit query int false "Page size"
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.SuperUserLibraryItem}
|
||||
// @Bind id path
|
||||
// @Bind filter query
|
||||
func (c *users) ListLibrary(ctx fiber.Ctx, id int64, filter *dto.SuperUserLibraryListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListUserLibrary(ctx, id, filter)
|
||||
}
|
||||
|
||||
// List user favorites
|
||||
//
|
||||
// @Router /super/v1/users/:id<int>/favorites [get]
|
||||
|
||||
Reference in New Issue
Block a user