超腾开源平台内容模块

2026-01-07 超腾开源 478 次阅读 0 次点赞
本文档详细介绍了内容模块API,该模块提供博客、微博、Wiki、产品文档等多种内容的管理功能。核心内容包括各内容类型(博客、微博、Wiki、产品文档)的完整CRUD操作接口,涵盖文章/文档的创建、编辑、发布、分页查询与删除。同时,文档详细说明了图片上传与管理、评论系统的增删改查,以及AI辅助功能(如自动提取摘要、生成标题和关键词)。此外,还包含主题管理、域名白名单、意见反馈、留言板、友情链接和邮件订阅等辅助功能的API。文档提供了清晰的接口地址、请求响应示例、参数说明及使用注意事项,为开发者集成内容管理服务提供了全面指导。

内容模块 API

概述

内容模块提供博客、微博、Wiki、产品文档等内容管理功能,支持内容创建、编辑、发布、评论、AI 辅助等功能。

目录


博客管理

博客模块提供文章的创建、编辑、发布、评论等功能。

博客主表 CRUD

获取博客详情

接口地址: GET /api/content/blogs/detail

需要认证: 是

请求参数:

参数 类型 必填 说明
id int 是 博客 ID

响应示例:

{
  "success": true,
  "code": 200,
  "msg": "操作成功",
  "data": {
    "id": "1",
    "title": "我的第一篇博客",
    "abstract": "这是博客摘要",
    "keywords": "博客,技术",
    "content": "博客内容...",
    "author_id": "1",
    "author_name": "张三",
    "app_id": "1",
    "app_name": "超腾论文",
    "blog_type": "blog",
    "image_urls": ["https://example.com/image1.jpg"],
    "status": "published",
    "like_count": 10,
    "is_top": false,
    "view_count": 100,
    "create_time": "2026-01-01T00:00:00Z",
    "update_time": "2026-01-01T00:00:00Z",
    "published_time": "2026-01-01T00:00:00Z"
  }
}

获取博客列表

接口地址: GET /api/content/blogs/list

需要认证: 是

请求参数:

参数 类型 必填 说明
title string 否 标题
keywords string 否 关键词
abstract string 否 摘要
author_id int 否 作者 ID
app_id int 否 应用 ID
blog_type string 否 博客类型(blog/microblog)
status string 否 状态(draft/published/deleted)
order string 否 排序字段

获取博客分页

接口地址: GET /api/content/blogs/page

需要认证: 是

请求参数:

参数 类型 必填 说明 默认值
page int 否 页码 1
page_size int 否 每页条数 10
title string 否 标题 -
… … … 其他参数同列表接口 -

创建博客

接口地址: POST /api/content/blogs/create

需要认证: 是

请求体:

{
  "title": "我的第一篇博客",
  "abstract": "这是博客摘要",
  "keywords": "博客,技术",
  "content": "博客内容...",
  "blog_type": "blog"
}

请求字段说明:

字段 类型 必填 说明
title string 是 标题
abstract string 否 摘要
keywords string 否 关键词
content string 是 内容
blog_type string 是 博客类型(blog/microblog)
author_id string 否 作者 ID(默认为当前用户)
app_id string 否 应用 ID
image_urls string[] 否 图片 URL 列表

更新博客

接口地址: POST /api/content/blogs/update

需要认证: 是

请求体: 同创建博客,需包含 id 字段。

删除博客

接口地址: POST /api/content/blogs/delete

需要认证: 是

请求参数:

参数 类型 必填 说明
id int 是 博客 ID

发布博客

接口地址: POST /api/content/blogs/publish

需要认证: 是

请求参数:

参数 类型 必填 说明
id int 是 博客 ID

博客图片管理

上传博客图片

接口地址: POST /api/content/blogs/{blog_id}/images

需要认证: 是

路径参数:

参数 类型 必填 说明
blog_id int 是 博客 ID

请求参数: multipart/form-data

参数 类型 必填 说明
files file[] 是 图片文件列表(支持多张)
image_type string 否 图片类型(content/cover/other),默认为 content

响应示例:

{
  "success": true,
  "code": 200,
  "msg": "上传成功",
  "data": [
    {
      "id": "1",
      "blog_id": "1",
      "image_url": "https://example.com/image1.jpg",
      "image_type": "content",
      "sort": 0,
      "create_time": "2026-01-01T00:00:00Z"
    }
  ]
}

获取博客图片列表

接口地址: GET /api/content/blogs/{blog_id}/images

需要认证: 是

删除博客图片

接口地址: POST /api/content/blogs/images/{image_id}

需要认证: 是

获取博客图片详情

接口地址: GET /api/content/blogs/image/detail

需要认证: 是

更新博客图片

接口地址: POST /api/content/blogs/image/update

需要认证: 是


博客评论管理

获取博客评论详情

接口地址: GET /api/content/blogs/comment/detail

需要认证: 是

获取博客评论列表

接口地址: GET /api/content/blogs/comment/list

需要认证: 是

请求参数:

参数 类型 必填 说明
blog_id string 否 博客 ID
user_id string 否 用户 ID
parent_id string 否 父评论 ID
status string 否 评论状态
order string 否 排序

获取博客评论分页

接口地址: GET /api/content/blogs/comment/page

需要认证: 是

创建博客评论

接口地址: POST /api/content/blogs/comment/create

需要认证: 是

请求体:

{
  "blog_id": "1",
  "content": "这是评论内容",
  "parent_id": "0"
}

字段说明:

字段 类型 必填 说明
blog_id string 是 博客 ID
content string 是 评论内容
parent_id string 否 父评论 ID(0 表示顶级评论)

更新博客评论

接口地址: POST /api/content/blogs/comment/update

需要认证: 是

删除博客评论

接口地址: POST /api/content/blogs/comment/delete

需要认证: 是


博客 AI 功能

AI 提取博客摘要

接口地址: POST /api/content/blogs/ai-extract-abstract

需要认证: 是

请求体:

{
  "content": "这是博客的完整内容..."
}

响应示例:

{
  "success": true,
  "code": 200,
  "msg": "提取成功",
  "data": "这是AI提取的摘要..."
}

AI 生成博客标题

接口地址: POST /api/content/blogs/ai-generate-title

需要认证: 是

请求体:

{
  "content": "这是博客的完整内容..."
}

AI 提取博客关键词

接口地址: POST /api/content/blogs/ai-extract-keywords

需要认证: 是

请求体:

{
  "content": "这是博客的完整内容..."
}

自动生成评论

接口地址: POST /api/content/blogs/auto-generate-comment

需要认证: 是

请求参数:

参数 类型 必填 说明
blog_id int 否 指定博客 ID(不指定则随机选择)

微博管理

微博模块提供短内容的创建、编辑、评论等功能。

微博主表 CRUD

所有接口与博客模块类似,但模型为 MicroblogVO,没有摘要和关键词字段,只包含内容字段。

接口地址 方法 说明
/api/content/microblogs/detail GET 获取微博详情
/api/content/microblogs/list GET 获取微博列表
/api/content/microblogs/page GET 获取微博分页
/api/content/microblogs/create POST 创建微博
/api/content/microblogs/update POST 更新微博
/api/content/microblogs/delete POST 删除微博

MicroblogVO Schema:

{
  "id": "string | null",
  "content": "string | null",
  "author_id": "string | null",
  "author_name": "string | null",
  "app_id": "string | null",
  "app_name": "string | null",
  "image_urls": ["string"] | null,
  "status": "draft | published | deleted",
  "like_count": "int | default 0",
  "is_top": "boolean | default false",
  "view_count": "int | default 0",
  "create_time": "datetime | null",
  "update_time": "datetime | null",
  "published_time": "datetime | null"
}

微博图片管理

接口地址 方法 说明
/api/content/microblogs/image/detail GET 获取微博图片详情
/api/content/microblogs/image/list GET 获取微博图片列表
/api/content/microblogs/image/create POST 创建微博图片
/api/content/microblogs/image/update POST 更新微博图片
/api/content/microblogs/image/delete POST 删除微博图片

微博评论管理

接口地址 方法 说明
/api/content/microblogs/comment/detail GET 获取微博评论详情
/api/content/microblogs/comment/list GET 获取微博评论列表
/api/content/microblogs/comment/page GET 获取微博评论分页
/api/content/microblogs/comment/create POST 创建微博评论
/api/content/microblogs/comment/update POST 更新微博评论
/api/content/microblogs/comment/delete POST 删除微博评论

Wiki 文档管理

Wiki 文档模块提供与 XWiki 集成的文档管理功能,支持空间管理、文档管理、SEO 优化等功能。

Wiki 空间管理

获取 XWiki 空间列表

接口地址: GET /api/content/xwiki/space/list

需要认证: 是

获取 XWiki 空间分页

接口地址: GET /api/content/xwiki/space/page

需要认证: 是

获取 XWiki 空间树

接口地址: GET /api/content/xwiki/space/tree

需要认证: 是

响应示例:

{
  "success": true,
  "code": 200,
  "msg": "操作成功",
  "data": [
    {
      "id": "1",
      "name": "Main",
      "xwiki_id": "Main",
      "url": "https://wiki.example.com/xwiki/bin/view/Main/",
      "page_url": "https://wiki.example.com/xwiki/bin/view/Main/WebHome",
      "children": [
        {
          "id": "2",
          "name": "Documentation",
          "xwiki_id": "Main.Documentation",
          "children": []
        }
      ]
    }
  ]
}

Wiki 文档管理

获取 XWiki 文档详情

接口地址: POST /api/content/xwiki/doc/detail

需要认证: 是

请求体:

{
  "id": "1"
}

响应示例:

{
  "success": true,
  "code": 200,
  "msg": "操作成功",
  "data": {
    "id": "1",
    "xwiki_id": "Main.WebHome",
    "title": "Welcome",
    "author": "admin",
    "url": "https://wiki.example.com/xwiki/bin/view/Main/WebHome",
    "create_time": "2026-01-01T00:00:00Z",
    "update_time": "2026-01-01T00:00:00Z",
    "content": "<p>Wiki content...</p>",
    "md5_digest": "abc123...",
    "modified": false,
    "optimized": false,
    "optimize_time": null,
    "pretty_title": "Welcome - Main",
    "pretty_h1": "Welcome",
    "pretty_description": "Welcome page",
    "pretty_keywords": "welcome,home",
    "pretty_abstract": "This is the welcome page",
    "pretty_content": "<p>Optimized content...</p>",
    "view_count": 100,
    "like_count": 10,
    "comment_count": 5,
    "redirect": false,
    "redirect_url": null,
    "content_need_optimized": false,
    "content_has_optimized": false,
    "topic_id": "1"
  }
}

获取 XWiki 文档列表

接口地址: GET /api/content/xwiki/doc/list

需要认证: 是

请求参数:

参数 类型 必填 说明
title string 否 标题
author string 否 作者
content string 否 内容
modified boolean 否 是否已修改
optimized boolean 否 是否已优化
redirect boolean 否 是否重定向
content_need_optimized boolean 否 内容需要优化
content_has_optimized boolean 否 内容已优化
order string 否 排序

获取 XWiki 文档分页

接口地址: GET /api/content/xwiki/doc/page

需要认证: 是

SEO 优化 XWiki 文档

接口地址: POST /api/content/xwiki/doc/seo-optimize

需要认证: 是

请求体:

{
  "id": "1"
}

取消 SEO 优化 XWiki 文档

接口地址: POST /api/content/xwiki/doc/cancel-seo-optimize

需要认证: 是

人工优化完成

接口地址: POST /api/content/xwiki/doc/complete-optimize

需要认证: 是

设置 XWiki 文档重定向

接口地址: POST /api/content/xwiki/doc/set-redirect

需要认证: 是

请求体:

{
  "id": "1",
  "redirect_url": "https://example.com/new-url"
}

取消 XWiki 文档重定向

接口地址: POST /api/content/xwiki/doc/cancel-redirect

需要认证: 是

设置 XWiki 文档为专题

接口地址: POST /api/content/xwiki/doc/set-topic

需要认证: 是

请求体:

{
  "id": "1",
  "topic_id": "1"
}

取消 XWiki 文档专题

接口地址: POST /api/content/xwiki/doc/cancel-topic

需要认证: 是

删除 Wiki

接口地址: POST /api/content/xwiki/doc/delete

需要认证: 是


Wiki 评论管理

接口地址 方法 说明
/api/content/xwiki/comment/detail POST 获取 XWiki 评论详情
/api/content/xwiki/comment/list GET 获取 XWiki 评论列表
/api/content/xwiki/comment/page GET 获取 XWiki 评论分页
/api/content/xwiki/comment/create POST 创建 XWiki 评论
/api/content/xwiki/comment/update POST 更新 XWiki 评论
/api/content/xwiki/comment/{id} POST 删除 XWiki 评论

自动生成文档评论

接口地址: POST /api/content/xwiki/doc/auto-generate-comment

需要认证: 是


产品文档管理

产品文档模块提供产品文档的管理功能,类似博客模块。

产品文档主表 CRUD

接口地址 方法 说明
/api/content/products/detail GET 获取产品文档详情
/api/content/products/list GET 获取产品文档列表
/api/content/products/page GET 获取产品文档分页
/api/content/products/create POST 创建产品文档
/api/content/products/update POST 更新产品文档
/api/content/products/delete POST 删除产品文档
/api/content/products/publish POST 发布产品文档

ProductVO Schema:

{
  "id": "string | null",
  "title": "string | null",
  "abstract": "string | null",
  "keywords": "string | null",
  "content": "string | null",
  "author_id": "string | null",
  "author_name": "string | null",
  "app_id": "string | null",
  "app_name": "string | null",
  "image_urls": ["string"] | null",
  "status": "draft | published | deleted",
  "like_count": "int | default 0",
  "is_top": "boolean | default false",
  "view_count": "int | default 0",
  "parent_id": "string | null",
  "code": "string | null",
  "create_time": "datetime | null",
  "update_time": "datetime | null",
  "published_time": "datetime | null"
}

产品文档图片管理

接口地址 方法 说明
/api/content/products/{product_id}/images POST 上传产品文档图片
/api/content/products/{product_id}/images GET 获取产品文档图片列表
/api/content/products/images/{image_id} POST 删除产品文档图片
/api/content/products/image/detail GET 获取产品文档图片详情
/api/content/products/image/update POST 更新产品文档图片

产品文档评论管理

接口地址 方法 说明
/api/content/products/comment/detail GET 获取产品文档评论详情
/api/content/products/comment/list GET 获取产品文档评论列表
/api/content/products/comment/page GET 获取产品文档评论分页
/api/content/products/comment/create POST 创建产品文档评论
/api/content/products/comment/update POST 更新产品文档评论
/api/content/products/comment/delete POST 删除产品文档评论

产品文档 AI 功能

接口地址 方法 说明
/api/content/products/ai-extract-abstract POST AI 提取产品文档摘要
/api/content/products/ai-generate-title POST AI 生成产品文档标题
/api/content/products/ai-extract-keywords POST AI 提取产品文档关键词

自动生成产品文档评论

接口地址: POST /api/content/products/auto-generate-comment

需要认证: 是


主题管理

主题模块用于管理 Wiki 文档的专题分类。

主题 CRUD

接口地址 方法 说明
/api/content/topics/detail GET 获取主题详情
/api/content/topics/list GET 获取主题列表
/api/content/topics/page GET 获取主题分页
/api/content/topics/create POST 创建主题
/api/content/topics/update POST 更新主题
/api/content/topics/delete POST 删除主题

TopicVO Schema:

{
  "id": "string | null",
  "name": "string",
  "description": "string | null",
  "cover_url": "string | null",
  "status": "active | inactive",
  "create_user": "string | null",
  "update_user": "string | null",
  "create_time": "string | null",
  "update_time": "string | null"
}

域名白名单

域名白名单模块用于管理允许外链的域名列表。

域名白名单 CRUD

接口地址 方法 说明
/api/content/domain-whitelists/detail GET 获取域名白名单详情
/api/content/domain-whitelists/list GET 获取域名白名单列表
/api/content/domain-whitelists/page GET 获取域名白名单分页
/api/content/domain-whitelists/create POST 创建域名白名单
/api/content/domain-whitelists/update POST 更新域名白名单
/api/content/domain-whitelists/delete POST 删除域名白名单

从 XWiki 同步域名

接口地址: POST /api/content/domain-whitelists/sync-from-xwiki

需要认证: 是

响应示例:

{
  "success": true,
  "code": 200,
  "msg": "同步成功",
  "data": ["example.com", "another.com"]
}

意见反馈

意见反馈模块用于接收和管理用户反馈。

反馈 CRUD

接口地址 方法 说明
/api/content/feedbacks/detail GET 获取反馈详情
/api/content/feedbacks/list GET 获取反馈列表
/api/content/feedbacks/page GET 获取反馈分页
/api/content/feedbacks/create POST 创建反馈
/api/content/feedbacks/anonymous/create POST 匿名创建反馈(无需登录)
/api/content/feedbacks/update POST 更新反馈(管理员回复)
/api/content/feedbacks/delete POST 删除反馈

FeedbackVO Schema:

{
  "id": "string | null",
  "app_id": "string | null",
  "app_name": "string | null",
  "user_id": "string | null",
  "user_name": "string | null",
  "title": "string | null",
  "content": "string | null",
  "contact_info": "string | null",
  "status": "pending | processing | resolved | rejected",
  "admin_reply": "string | null",
  "replied_by": "string | null",
  "replied_by_name": "string | null",
  "create_time": "datetime | null",
  "update_time": "datetime | null"
}

留言板

留言板模块提供公开留言功能。

留言 CRUD

接口地址 方法 说明 认证
/api/content/guestbooks/detail GET 获取留言详情 是
/api/content/guestbooks/list GET 获取留言列表(树形结构) 是
/api/content/guestbooks/page GET 获取留言分页(树形结构) 是
/api/content/guestbooks/public/list GET 获取公开留言列表(网站端) 否
/api/content/guestbooks/public/page GET 获取公开留言分页(网站端) 否
/api/content/guestbooks/create POST 创建留言 是
/api/content/guestbooks/anonymous/create POST 匿名创建留言(网站端) 否
/api/content/guestbooks/update POST 更新留言(管理员) 是
/api/content/guestbooks/delete POST 删除留言 是

GuestbookVO Schema:

{
  "id": "string | null",
  "parent_id": "string | null",
  "reply_to_id": "string | null",
  "user_id": "string | null",
  "user_name": "string | null",
  "content": "string | null",
  "contact_info": "string | null",
  "is_public": "boolean | null",
  "is_pinned": "boolean | null",
  "ip_address": "string | null",
  "create_time": "datetime | null",
  "update_time": "datetime | null",
  "reply_to_user_name": "string | null",
  "children": ["GuestbookVO"] | null
}

友情链接

友情链接模块用于管理网站的友情链接。

友情链接 CRUD

接口地址 方法 说明
/api/content/links/detail GET 获取友情链接详情
/api/content/links/list GET 获取友情链接列表
/api/content/links/page GET 获取友情链接分页
/api/content/links/create POST 创建友情链接
/api/content/links/update POST 更新友情链接
/api/content/links/delete POST 删除友情链接
/api/content/links/approve POST 审核通过友情链接
/api/content/links/reject POST 审核拒绝友情链接
/api/content/links/check POST 检查所有友链

LinkVO Schema:

{
  "id": "string | null",
  "name": "string | null",
  "url": "string | null",
  "link_url": "string | null",
  "logo_url": "string | null",
  "description": "string | null",
  "email": "string | null",
  "status": "pending | approved | rejected",
  "sort_order": "int | default 0",
  "admin_reply": "string | null",
  "create_time": "datetime | null",
  "update_time": "datetime | null"
}

LinkCheckResult Schema:

{
  "id": "string",
  "name": "string",
  "url": "string",
  "robots_valid": "boolean",
  "backlink_valid": "boolean",
  "error_message": "string | null"
}

邮件订阅

邮件订阅模块用于管理用户的邮件订阅。

邮件订阅 CRUD

接口地址 方法 说明 认证
/api/content/email-subscriptions/detail GET 获取邮件订阅详情 是
/api/content/email-subscriptions/list GET 获取邮件订阅列表 是
/api/content/email-subscriptions/page GET 获取邮件订阅分页 是
/api/content/email-subscriptions/create POST 创建邮件订阅 否
/api/content/email-subscriptions/verify POST 验证邮件订阅 否
/api/content/email-subscriptions/update POST 更新邮件订阅 是
/api/content/email-subscriptions/delete POST 删除邮件订阅 是

EmailSubscriptionVO Schema:

{
  "id": "string | null",
  "email": "string | null",
  "subscription_type": "blog | product | xwiki | all",
  "status": "active | inactive",
  "verification_code": "string | null",
  "is_verified": "boolean | default false",
  "create_time": "datetime | null",
  "update_time": "datetime | null"
}

枚举类型说明

博客类型 (BlogType)

值 说明
blog 博客文章
microblog 微博

内容状态 (ContentStatus)

值 说明
draft 草稿
published 已发布
deleted 已删除

评论状态 (CommentStatus)

值 说明
pending_review 待审核
reviewed 已审核
hidden 已隐藏

反馈状态 (FeedbackStatus)

值 说明
pending 待处理
processing 处理中
resolved 已解决
rejected 已拒绝

链接状态 (LinkStatus)

值 说明
pending 待审核
approved 已通过
rejected 已拒绝

主题状态 (TopicStatus)

值 说明
active 激活
inactive 未激活

订阅类型 (EmailSubscriptionType)

值 说明
blog 博客订阅
product 产品订阅
xwiki Wiki 订阅
all 全部订阅

订阅状态 (EmailSubscriptionStatus)

值 说明
active 激活
inactive 未激活

使用示例

Python 示例

import requests

base_url = 'http://localhost:8000/api/content'
token = 'your_access_token'
headers = {'Authorization': f'Bearer {token}'}

# 创建博客
response = requests.post(
    f'{base_url}/blogs/create',
    headers=headers,
    json={
        'title': '我的第一篇博客',
        'content': '这是博客内容...',
        'blog_type': 'blog'
    }
)
print(response.json())

# 上传博客图片
files = {'files': open('image.jpg', 'rb')}
response = requests.post(
    f'{base_url}/blogs/1/images',
    headers=headers,
    files=files
)
print(response.json())

# 创建博客评论
response = requests.post(
    f'{base_url}/blogs/comment/create',
    headers=headers,
    json={
        'blog_id': '1',
        'content': '这是评论内容'
    }
)
print(response.json())

# AI 提取摘要
response = requests.post(
    f'{base_url}/blogs/ai-extract-abstract',
    headers=headers,
    json={
        'content': '这是博客的完整内容...'
    }
)
print(response.json())

JavaScript 示例

// 创建博客
async function createBlog(token, blogData) {
  const response = await fetch(
    "http://localhost:8000/api/content/blogs/create",
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${token}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify(blogData),
    }
  );
  return await response.json();
}

// 上传图片
async function uploadBlogImages(token, blogId, files) {
  const formData = new FormData();
  files.forEach((file) => formData.append("files", file));

  const response = await fetch(
    `http://localhost:8000/api/content/blogs/${blogId}/images`,
    {
      method: "POST",
      headers: { Authorization: `Bearer ${token}` },
      body: formData,
    }
  );
  return await response.json();
}

// 获取博客列表
async function getBlogs(token, filters = {}) {
  const params = new URLSearchParams(filters);
  const response = await fetch(
    `http://localhost:8000/api/content/blogs/list?${params}`,
    {
      headers: { Authorization: `Bearer ${token}` },
    }
  );
  return await response.json();
}

注意事项

  1. 图片上传: 上传图片使用 multipart/form-data 格式,支持同时上传多张图片。
  2. AI 功能: AI 功能需要配置相应的大模型服务,确保服务可用性。
  3. 评论审核: 评论默认为待审核状态,管理员审核通过后才会公开显示。
  4. Wiki 同步: Wiki 文档数据从 XWiki 同步,需要确保 XWiki 服务配置正确。
  5. SEO 优化: Wiki 文档的 SEO 优化功能包括提取标题、关键词、摘要、描述等。
  6. 外链白名单: Wiki 内容中的外链接域名需要在白名单中才能显示。
  7. 匿名访问: 部分接口支持匿名访问(如创建反馈、匿名留言),但功能受限。
  8. 分页查询: 大量数据建议使用分页查询,默认每页 10 条记录。

相关文档

本文由人工编写,AI优化,转载请注明原文地址: 超腾开源平台内容模块

评论 (0)

请 登录 后发表评论

暂无评论,快来发表第一条评论吧!