超腾开源平台数据模型参考

2026-01-07 超腾开源 39 次阅读 0 次点赞
本文档详细介绍了超腾开源平台API中使用的核心数据模型,涵盖了通用、系统、内容、商业、AI、工作及统计等多个模块。文档首先定义了统一的API响应格式Result和分页查询格式PageData。随后,系统性地列出了各模块的关键视图对象,如UserVO(用户)、RoleVO(角色)、BlogVO(博客)、ItemVO(商品)、LLMModelVO(大模型)、NotificationVO(通知)等,并提供了每个字段的数据类型、说明和示例。文档还说明了基础数据类型、时间格式、分页查询通用参数、枚举类型(如状态字段)以及数据验证规则(如字符串长度、数值范围)。其目的是为开发者提供清晰、完整的数据结构参考,确保API交互的数据一致性和规范性。

本文档详细列出了超腾开源平台 API 中使用的所有数据模型,包括字段说明、数据类型和验证规则。

通用数据模型

Result(执行结果)

所有 API 接口的统一响应格式。

{
  success: boolean; // 是否成功
  code: number; // 错误码,200:成功,其他:失败
  msg: string; // 消息
  data: T | null; // 数据
}

PageData(分页数据)

分页查询的响应格式。

{
  total: number;              // 总条数
  size: number;              // 每页条数
  pages: number;             // 总页数
  current: number;           // 当前页
  records: T[];              // 分页记录列表
  orders: string[] | null;   // 排序信息
}

系统模块数据模型

UserVO(用户视图)

{
  id: string | null; // 用户ID
  username: string | null; // 用户名
  nickname: string | null; // 昵称
  sex: string | null; // 性别
  email: string | null; // 邮箱
  phone: string | null; // 手机号
  password: string | null; // 密码(明文,仅用于创建/更新)
  hashed_password: string | null; // 加密密码(不返回)
  is_active: boolean | null; // 是否激活
  is_superuser: boolean | null; // 是否超级用户
  role_id: string | null; // 角色ID
  role_name: string | null; // 角色名
  create_time: string | null; // 创建时间 (格式: YYYY-MM-DD HH:mm:ss)
  update_time: string | null; // 更新时间 (格式: YYYY-MM-DD HH:mm:ss)
  is_deleted: boolean | null; // 是否删除(不返回)
}

RoleVO(角色视图)

{
  id: string | null; // 角色ID
  name: string | null; // 角色名
  description: string | null; // 描述
  permissions: string | null; // 权限
  is_active: boolean | null; // 是否激活
  create_time: string | null; // 创建时间
  update_time: string | null; // 更新时间
}
{
  id: string | null;           // 菜单ID
  parent_id: string | null;    // 父菜单ID
  name: string | null;         // 菜单名
  path: string | null;         // 路径
  component: string | null;    // 组件
  type: 'M' | 'C' | 'F';      // 菜单类型(M=目录, C=菜单, F=按钮)
  perms: string | null;        // 权限
  icon: string | null;         // 图标
  sort: number | null;         // 排序
  is_cache: boolean | null;    // 是否缓存
  is_visible: boolean | null;  // 是否可见
  is_frame: boolean | null;   // 是否外链
  status: boolean | null;     // 状态
  children: MenuVO[];         // 子菜单
}

OrganizationVO(组织机构视图)

{
  id: string | null;           // 组织ID
  parent_id: string | null;    // 父组织ID
  name: string | null;         // 组织名
  code: string | null;         // 组织编码
  sort: number | null;         // 排序
  leader: string | null;       // 负责人
  phone: string | null;        // 电话
  email: string | null;        // 邮箱
  status: boolean | null;     // 状态
  description: string | null;  // 描述
  children: OrganizationVO[];  // 子组织
}

Token(令牌)

{
  access_token: string; // 访问令牌
  token_type: string; // 令牌类型
}

内容模块数据模型

BlogVO(博客视图)

{
  id: string | null;              // 博客ID
  title: string | null;           // 标题
  abstract: string | null;        // 摘要
  keywords: string | null;        // 关键词
  content: string | null;         // 内容
  author_id: string | null;       // 作者ID
  author_name: string | null;     // 作者名
  app_id: string | null;          // 应用ID
  app_name: string | null;        // 应用名
  blog_type: 'original' | 'reprint' | 'translation';  // 博客类型
  image_urls: string[] | null;    // 图片URL列表
  status: 'draft' | 'published' | 'archived';  // 博客状态
  like_count: number | null;      // 点赞数
  is_top: boolean | null;         // 是否置顶
  view_count: number | null;      // 浏览量
  published_time: string | null;  // 发布时间
}

MicroblogVO(微博视图)

{
  id: string | null;              // 微博ID
  content: string | null;         // 内容
  author_id: string | null;       // 作者ID
  author_name: string | null;     // 作者名
  app_id: string | null;          // 应用ID
  app_name: string | null;        // 应用名
  image_urls: string[] | null;    // 图片URL列表
  status: 'draft' | 'published' | 'archived';  // 微博状态
  like_count: number | null;      // 点赞数
  is_top: boolean | null;         // 是否置顶
  view_count: number | null;      // 浏览量
}

ProductVO(产品文档视图)

{
  id: string | null;              // 产品ID
  title: string | null;           // 标题
  abstract: string | null;        // 摘要
  keywords: string | null;        // 关键词
  content: string | null;         // 内容
  author_id: string | null;       // 作者ID
  author_name: string | null;     // 作者名
  app_id: string | null;          // 应用ID
  app_name: string | null;        // 应用名
  image_urls: string[] | null;    // 图片URL列表
  status: 'draft' | 'published' | 'archived';  // 产品状态
  like_count: number | null;      // 点赞数
  is_top: boolean | null;         // 是否置顶
  view_count: number | null;      // 浏览量
  parent_id: string | null;      // 父产品ID
  code: string | null;            // 产品编码
}

XWikiDocVO(XWiki 文档视图)

{
  id: string; // 文档ID
  xwiki_id: string; // XWiki ID
  title: string; // 标题
  author: string; // 作者
  url: string; // URL
  create_time: string; // 创建时间
  update_time: string; // 更新时间
  content: string | null; // 内容
  md5_digest: string | null; // MD5摘要
  modified: boolean | null; // 是否修改
  optimized: boolean | null; // 是否优化
  optimize_time: string | null; // 优化时间
  pretty_title: string | null; // 优化标题
  pretty_h1: string | null; // 优化H1
  pretty_description: string | null; // 优化描述
  pretty_keywords: string | null; // 优化关键词
  pretty_abstract: string | null; // 优化摘要
  pretty_content: string | null; // 优化内容
  view_count: number | null; // 浏览量
  like_count: number | null; // 点赞数
  comment_count: number | null; // 评论数
  redirect: boolean | null; // 是否重定向
  redirect_url: string | null; // 重定向URL
  content_need_optimized: boolean | null; // 内容需要优化
  content_has_optimized: boolean | null; // 内容已优化
  topic_id: string | null; // 主题ID
}

GuestbookVO(留言板视图)

{
  id: string | null;              // 留言ID
  parent_id: string | null;       // 父留言ID
  reply_to_id: string | null;     // 回复对象ID
  user_id: string | null;         // 用户ID
  user_name: string | null;       // 用户名
  content: string | null;         // 内容
  contact_info: string | null;    // 联系信息
  is_public: boolean | null;      // 是否公开
  is_pinned: boolean | null;      // 是否置顶
  ip_address: string | null;      // IP地址
  reply_to_user_name: string | null;  // 回复的用户名
  children: GuestbookVO[];       // 子留言列表
}

商业模块数据模型

ItemVO(商品视图)

{
  id: string | null; // 商品ID
  code: string | null; // 商品编码
  name: string | null; // 商品名称
  description: string | null; // 描述
  detail: string | null; // 详情
  price: number | null; // 价格(单位:分)
  discount_price: number | null; // 折扣价(单位:分)
  stock: number | null; // 库存
  category: string | null; // 分类
  category_name: string | null; // 分类名称
  version: string | null; // 版本
  thumbnail: string | null; // 缩略图
  status: "active" | "inactive" | "out_of_stock"; // 商品状态
  is_active: boolean | null; // 是否激活
}

OrderVO(订单视图)

{
  id: string | null; // 订单ID
  user_id: string | null; // 用户ID
  order_number: string | null; // 订单号
  total_amount: number | null; // 总金额(单位:分)
  status: "pending" | "paid" | "shipped" | "completed" | "cancelled"; // 订单状态
  payment_method: string | null; // 支付方式
  shipping_address: string | null; // 收货地址
  shipping_fee: number | null; // 运费(单位:分)
  note: string | null; // 备注
  paid_time: string | null; // 支付时间
  shipped_time: string | null; // 发货时间
  completed_time: string | null; // 完成时间
}

ShoppingCartVO(购物车视图)

{
  id: string | null; // 购物车ID
  user_id: string | null; // 用户ID
  item_id: string | null; // 商品ID
  quantity: number | null; // 数量
  is_selected: boolean | null; // 是否选中
  item_name: string | null; // 商品名称
  item_price: number | null; // 商品价格(单位:分)
  item_discount_price: number | null; // 商品折扣价(单位:分)
  item_stock: number | null; // 商品库存
  item_thumbnail: string | null; // 商品缩略图
  item_is_active: boolean | null; // 商品是否激活
}

AI 模块数据模型

LLMModelVO(大模型视图)

{
  id: string | null; // 模型ID
  name: string | null; // 模型名称
  description: string | null; // 模型描述
  provider_id: string | null; // 提供商ID
  provider_name: string | null; // 提供商名称
  model_name: string | null; // 模型标识
  model_type: string | null; // 模型类型
  parameters: string | null; // 模型参数(JSON字符串)
  supports_streaming: boolean | null; // 是否支持流式
  max_input_length: number | null; // 最大输入长度
  max_output_length: number | null; // 最大输出长度
  rate_limit_per_minute: number | null; // 每分钟请求限制
  creator_id: string | null; // 创建人ID
  creator_name: string | null; // 创建人名称
  app_id: string | null; // 应用ID
  app_name: string | null; // 应用名称
  status: "active" | "inactive"; // 模型状态
  is_default: boolean | null; // 是否默认
  sort_order: number | null; // 排序
}

PromptVO(提示词视图)

{
  id: string | null;              // 提示词ID
  name: string | null;            // 提示词名称
  description: string | null;     // 提示词描述
  content: string | null;         // 提示词内容
  category: string | null;        // 分类
  tags: string[] | null;         // 标签列表
  creator_id: string | null;     // 创建人ID
  creator_name: string | null;   // 创建人名称
  app_id: string | null;          // 应用ID
  app_name: string | null;        // 应用名称
  status: 'active' | 'inactive';  // 提示词状态
  is_public: boolean | null;      // 是否公开
  usage_count: number | null;     // 使用次数
}

AgentVO(智能体视图)

{
  id: string | null;              // 智能体ID
  name: string | null;            // 智能体名称
  description: string | null;     // 智能体描述
  agent_key: string | null;       // 智能体标识
  system_prompt: string | null;   // 系统提示词
  prompt_ids: string[] | null;    // 提示词ID列表
  mcp_tool_ids: string[] | null;  // MCP工具ID列表
  config: Record<string, any> | null;  // 配置
  creator_id: string | null;     // 创建人ID
  creator_name: string | null;   // 创建人名称
  app_id: string | null;          // 应用ID
  app_name: string | null;        // 应用名称
  status: 'active' | 'inactive';  // 智能体状态
  is_enabled: boolean | null;     // 是否启用
  is_public: boolean | null;      // 是否公开
  sort_order: number | null;     // 排序
  usage_count: number | null;     // 使用次数
}

工作模块数据模型

NotificationVO(消息通知视图)

{
  id: string | null; // 通知ID
  title: string | null; // 标题
  content: string | null; // 内容
  type: "system" | "user" | "reminder"; // 通知类型
  user_id: string | null; // 用户ID
  user_name: string | null; // 用户名
  sender_id: string | null; // 发送者ID
  sender_name: string | null; // 发送者名称
  is_read: boolean | null; // 是否已读
  status: "normal" | "deleted"; // 通知状态
  priority: "low" | "medium" | "high"; // 通知优先级
  expire_time: string | null; // 过期时间
}

WorkPlanVO(工作计划视图)

{
  id: string | null; // 计划ID
  name: string | null; // 计划名称
  plan_type: "daily" | "weekly" | "monthly" | "quarterly" | "yearly"; // 计划类型
  start_time: string | null; // 开始时间
  end_time: string | null; // 结束时间
  status: "pending" | "in_progress" | "completed" | "cancelled"; // 计划状态
  content: string | null; // 计划内容
  actual_completion: string | null; // 实际完成情况
  summary_reflection: string | null; // 总结和反思
  creator_id: string | null; // 创建人ID
}

统计模块数据模型

PageViewVO(页面访问视图)

{
  id: string | null; // 访问ID
  url: string | null; // URL
  ip_address: string | null; // IP地址
  user_agent: string | null; // 用户代理
  referrer: string | null; // 来源
  visitor_id: string | null; // 访客ID
  browser: string | null; // 浏览器
  os: string | null; // 操作系统
  device: string | null; // 设备
  country: string | null; // 国家
  region: string | null; // 地区
  city: string | null; // 城市
  source_type: "direct" | "referral" | "search" | "social"; // 来源类型
  search_engine: string | null; // 搜索引擎
  is_new_visitor: boolean | null; // 是否新访客
  create_time: string | null; // 创建时间
}

DailyAnalyticsVO(每日统计视图)

{
  id: string | null; // 统计ID
  date: string | null; // 日期
  url: string | null; // URL
  pv_count: number | null; // 页面浏览量
  uv_count: number | null; // 独立访客数
  ip_count: number | null; // 独立IP数
  direct_count: number | null; // 直接访问数
  referral_count: number | null; // 外链访问数
  search_count: number | null; // 搜索访问数
  social_count: number | null; // 社交访问数
  new_visitor_count: number | null; // 新访客数
}

数据类型说明

基础类型

  • string: 字符串类型
  • number: 数字类型(整数和浮点数)
  • boolean: 布尔类型
  • T[] | null: 数组类型,可能为 null
  • T | null: 可选类型,可能为 null

时间格式

所有时间字段都使用 YYYY-MM-DD HH:mm:ss 格式返回。

分页查询

所有分页查询接口都支持以下通用参数:

参数 类型 说明 默认值
page number 页码 1
page_size number 每页条数 10
order string 排序字段,格式:字段_排序方式,如 create_time_desc -

枚举类型

BlogStatus(博客状态)

  • draft: 草稿
  • published: 已发布
  • archived: 已归档

ItemStatus(商品状态)

  • active: 上架
  • inactive: 下架
  • out_of_stock: 缺货

OrderStatus(订单状态)

  • pending: 待付款
  • paid: 已付款
  • shipped: 已发货
  • completed: 已完成
  • cancelled: 已取消

LLMModelStatus(大模型状态)

  • active: 激活
  • inactive: 未激活

NotificationPriority(通知优先级)

  • low: 低
  • medium: 中
  • high: 高

数据验证规则

字符串长度

  • 用户名: 3-50 字符
  • 密码: 6-100 字符
  • 邮箱: 符合邮箱格式

数值范围

  • 价格: 非负数
  • 数量: 正整数
  • 分页: page >= 1, page_size >= 1

状态枚举

所有状态字段都使用预定义的枚举值,确保数据一致性。

相关文档

本文由人工编写,AI优化,转载请注明原文地址: 超腾开源平台数据模型参考

评论 (0)

发表评论

昵称:加载中...

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