morte change

This commit is contained in:
2025-03-14 21:10:50 +08:00
parent 5a03323c69
commit 942fb592b5
6 changed files with 802 additions and 271 deletions

View File

@@ -2923,14 +2923,14 @@ export const openAPISpec = {
},
'/api/analytics/popular-posts': {
get: {
summary: '获取热门文数据',
description: '返回按互动数量或互动率排序的热门帖文列表',
summary: '获取热门文数据',
description: '返回按互动数量或互动率排序的热门帖文',
tags: ['Analytics'],
parameters: [
{
name: 'timeRange',
in: 'query',
description: '时间范围(天)',
description: '时间范围(天)',
schema: {
type: 'string',
enum: ['7', '30', '90'],
@@ -2940,7 +2940,7 @@ export const openAPISpec = {
{
name: 'projectId',
in: 'query',
description: '项目ID过滤',
description: '项目ID',
schema: {
type: 'string'
}
@@ -2948,10 +2948,9 @@ export const openAPISpec = {
{
name: 'platform',
in: 'query',
description: '平台过滤',
description: '平台',
schema: {
type: 'string',
enum: ['Twitter', 'Instagram', 'TikTok', 'Facebook', 'YouTube']
type: 'string'
}
},
{
@@ -2967,7 +2966,7 @@ export const openAPISpec = {
{
name: 'limit',
in: 'query',
description: '返回数量',
description: '返回数量限制',
schema: {
type: 'integer',
default: 10,
@@ -2977,36 +2976,58 @@ export const openAPISpec = {
],
responses: {
'200': {
description: '成功响应',
description: '热门帖文数据',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
success: { type: 'boolean', example: true },
success: {
type: 'boolean'
},
data: {
type: 'array',
items: {
type: 'object',
properties: {
post_id: { type: 'string', example: 'post_123' },
title: { type: 'string', example: '新产品发布' },
platform: { type: 'string', example: 'Instagram' },
influencer_id: { type: 'string', example: 'inf_456' },
influencer_name: { type: 'string', example: '时尚KOL' },
publish_date: { type: 'string', example: '2025-03-10 10:30:00' },
engagement_count: { type: 'number', example: 2350 },
views_count: { type: 'number', example: 15600 },
engagement_rate: { type: 'number', example: 0.1506 },
is_high_engagement: { type: 'boolean', example: true }
title: {
type: 'string'
},
platform: {
type: 'string'
},
influencer_name: {
type: 'string'
},
publish_date: {
type: 'string',
format: 'date-time'
},
engagement_count: {
type: 'integer'
},
views_count: {
type: 'integer'
},
engagement_rate: {
type: 'number',
format: 'float'
},
is_high_engagement: {
type: 'boolean'
}
}
}
},
metadata: {
type: 'object',
properties: {
total: { type: 'number', example: 45 },
high_engagement_count: { type: 'number', example: 8 }
total: {
type: 'integer'
},
high_engagement_count: {
type: 'integer'
}
}
}
}
@@ -3015,33 +3036,144 @@ export const openAPISpec = {
}
},
'400': {
description: '参数错误',
description: '请求参数错误',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
success: { type: 'boolean', example: false },
error: { type: 'string', example: 'Invalid sortBy. Must be engagement_count or engagement_rate.' }
}
$ref: '#/components/schemas/Error'
}
}
}
},
'500': {
description: '服务器错误',
content: {
'application/json': {
schema: {
$ref: '#/components/schemas/Error'
}
}
}
}
}
}
},
'/api/analytics/moderation-status': {
get: {
summary: '获取内容审核状态分布',
description: '返回已批准、待审核和已拒绝内容的数量和比例',
tags: ['Analytics'],
parameters: [
{
name: 'timeRange',
in: 'query',
description: '时间范围(天)',
schema: {
type: 'string',
enum: ['7', '30', '90'],
default: '30'
}
},
{
name: 'projectId',
in: 'query',
description: '项目ID',
schema: {
type: 'string'
}
},
{
name: 'contentType',
in: 'query',
description: '内容类型',
schema: {
type: 'string',
enum: ['post', 'comment', 'all'],
default: 'all'
}
}
],
responses: {
'200': {
description: '审核状态分布数据',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
success: { type: 'boolean', example: false },
error: { type: 'string', example: 'Failed to fetch popular posts data' },
message: { type: 'string', example: 'Internal server error' }
success: {
type: 'boolean'
},
data: {
type: 'object',
properties: {
statuses: {
type: 'object',
properties: {
approved: {
type: 'integer',
description: '已批准内容数量'
},
pending: {
type: 'integer',
description: '待审核内容数量'
},
rejected: {
type: 'integer',
description: '已拒绝内容数量'
}
}
},
percentages: {
type: 'object',
properties: {
approved: {
type: 'number',
format: 'float',
description: '已批准内容百分比'
},
pending: {
type: 'number',
format: 'float',
description: '待审核内容百分比'
},
rejected: {
type: 'number',
format: 'float',
description: '已拒绝内容百分比'
}
}
},
total: {
type: 'integer',
description: '内容总数'
}
}
}
}
}
}
}
},
'400': {
description: '请求参数错误',
content: {
'application/json': {
schema: {
$ref: '#/components/schemas/Error'
}
}
}
},
'500': {
description: '服务器错误',
content: {
'application/json': {
schema: {
$ref: '#/components/schemas/Error'
}
}
}
}
}
}