1 Star 0 Fork 0

Hal / api-platform

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

码农共享API

项目简介

「码农共享API」是一款高效、可靠和安全的接口开放平台,为广大用户提供高质量、可靠、安全的接口服务,帮助用户轻松实现各种功能和数据交互,提高工作效率和用户体验。

本项目为前后端分离项目,前端主要采用AntDesign Pro开发框架搭建页面。后端采用Spring Cloud SpringBoot 作为业务框架。通过Spring Cloud Gateway作为全局网关实现流量控制、负载均衡以及路由管理,使用Mybatis-plus作为持久层技术。使用Apache Dubbo做高性能远程服务调用。同时Nacos作为注册中心,完成服务注册与发现,通过各模块主要功能以及业务进行模块的合理划分。通过全链路日志以及回调配置, 支持异步接口调用

主要开源组件与版本

item version
JDK 1.8
SpringBoot 2.7.5
SpringCloud 2021.0.5
Apache Dubbo 3.2.11
OpenAPI 3
MySQL 5.7
Redis 5.0.14
Mybatis-Plus 3.5.1
Nacos 2.1.0

关于版本说明 , 项目开发时使用是JDK1.8

建议使用JDK1.8

主要功能说明

发布接口

接口表根据易变信息分成了两个表 : interface_info 以及 ser_interface_info

结构如下:

前者主要是接口的基本信息, 后者主要包含 用户调用接口记录的信息。

-- pro
create table if not exists `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 '接口地址',
  `requestParams`  text                               not null comment '请求参数',
  `requestHeader`  text                               null comment '请求头',
  `responseHeader` text                               null comment '响应头',
  `status`         int      default 0                 not null comment '接口状态(0-关闭,1-开启)',
  `method`         varchar(256)                       not null comment '请求类型',
  `userId`         bigint                             not null comment '创建人',
  `createTime`     datetime default CURRENT_TIMESTAMP not null comment '创建时间',
  `updateTime`     datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
  `isDelete`       tinyint  default 0                 not null comment '是否删除(0-未删, 1-已删)'
) comment '接口信息';

-- 用户调用接口关系表
create table if not exists `user_interface_info`
(
  `id`              bigint                             not null auto_increment comment '主键' primary key,
  `userId`          bigint                             not null comment '调用用户 id',
  `interfaceInfoId` bigint                             not null comment '接口 id',
  `totalNum`        int      default 0                 not null comment '总调用次数',
  `leftNum`         int      default 0                 not null comment '剩余调用次数',
  `status`          int      default 0                 not null comment '0-正常,1-禁用',
  `createTime`      datetime default CURRENT_TIMESTAMP not null comment '创建时间',
  `updateTime`      datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
  `isDelete`        tinyint  default 0                 not null comment '是否删除(0-未删, 1-已删)'
) comment '用户调用接口关系';

对于发布接口 , 流程是

Knife4j文档聚合

启动项目 , 访问http://localhost:8666/doc.html即可进行查看。

在微服务架构下,每个后台应用都接入swagger 在线文档,在服务特别多的情况下,就需要做聚合文档处理,也就是将所有服务的文档聚合在一起。

Spring Cloud Gateway作为微服务的API网关,可以整合swagger 实现聚合接口文档。

其他主要功能

  • Spring Boot 2.7.5
  • Spring MVC
  • MySQL 驱动
  • MyBatis
  • MyBatis Plus
  • Spring Session Redis 分布式登录
  • Spring AOP
  • Apache Commons Lang3 工具类
  • Lombok 注解
  • Swagger + Knife4j 接口文档
  • Spring Boot 调试工具和项目处理器
  • 全局请求响应拦截器(记录日志)
  • 全局异常处理器
  • 自定义错误码
  • 封装通用响应类
  • 示例用户注册、登录、搜索功能
  • 示例单元测试类
  • 示例 SQL(用户表)

TODO

  • 更新签名
  • 查看接口页中的时间格式(所有时间格式)
  • 前端"调用"处根据不同的请求头显示不同的填写参数(参考接口文档)
  • 模拟接口调用 + 相应日志
  • 修改api User 名字
  • 删除前后端post及openApi中的

空文件

简介

api管理系統 展开 收起
Java
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/HalGwo/api-platform.git
git@gitee.com:HalGwo/api-platform.git
HalGwo
api-platform
api-platform
master

搜索帮助