项目概述与设计
# API 调用平台
# 项目介绍
一个提供 API 接口供开发者调用的平台。(类似腾讯云)
用户可以注册登录,开通接口调用权限。用户可以浏览接口并调用,且每次调用会进行统计。
管理员可以发布接口、下线接口、接入接口,以及可视化接口的调用情况、数据。
项目侧重于后端,包含较多的编程技巧和架构设计层面的知识。
# 第一阶段
# 主要内容
- 项目介绍、业务流程、项目计划、需求分析
- 数据库表设计
- 前后端项目初始化(包含
Ant Design Pro框架最新版本的使用) - 前后端代码自动生成(提高开发效率)
- 登录页、接口信息页开发
# 需求分析
背景:
- 前端开发需要用到后台接口
- 使用现成的系统的功能(博天api (opens new window))
做一个 API 接口平台:
- 管理员可以对接口信息进行增删改查
- 用户可以访问前台,查看接口信息
其他要求:
- 防止攻击(安全性)
- 不能随便调用(限制、开通)—— 限制流量,避免系统崩溃
- 统计调用次数
- 计费
- 流量保护
API接入
# 业务流程

# 技术选型
# 前端
Ant Design ProReactAnt Design ProcomponentsUmiUmi Request(Axios的封装)
# 后端
Java Spring BootSpring Boot Starter(SDK开发)Dubbo(RPC)NacosSpring Cloud Gateway(网关、限流、日志实现)
# 数据库表设计
-- 接口信息
create table if not exists myapi.`interface_info`
(
`id` bigint not null auto_increment comment '主键' primary key,
`name` varchar(256) not null comment '接口名称',
`description` varchar(256) null comment '描述',
`url` varchar(512) not null comment '接口地址',
`request_header` text null comment '请求头',
`response_header` text null comment '响应头',
`status` int default 0 not null comment '接口状态(0-关闭,1-开启)',
`method` varchar(256) not null comment '请求类型',
`user_id` bigint not null comment '创建人',
`create_time` datetime default CURRENT_TIMESTAMP not null comment '创建时间',
`update_time` datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
`is_deleted` tinyint default 0 not null comment '是否删除(0-未删, 1-已删)'
) comment '接口信息';
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 项目脚手架
- 前端:
Ant Design Pro脚手架(https://pro.ant.design/zh-cn/) - 后端:
springboot-init后端代码模板
# 基础功能开发
增删改查、登录功能(通过对模板的复制粘贴修改完成)。
前端接口调用:后端使用遵循 openapi 规范的 swagger 文档,使用前端 Ant Design Pro 框架集成的 openapi 插件自动生成。
上次更新: 2026/10/10 17:43:40