Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# eoefans-api
[![EOEFANS-API-DOCKER-CI](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-api-docker-ci.yml/badge.svg)](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-api-docker-ci.yml)
[![EOEFANS-SPIDER-DOCKER-CI](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-spider-docker-ci.yml/badge.svg)](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-spider-docker-ci.yml)
[![EOEFANS-API-AZURE-DEPLOY](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-api-azure-deploy.yml/badge.svg)](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-api-azure-deploy.yml)
[![EOEFANS-SPIDER-AZURE-DEPLOY](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-spider-azure-deploy.yml/badge.svg)](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-spider-azure-deploy.yml)
```
________ _____
_____ ______ _____ ___ __/______ ________ ________ ______ _________ ___(_)
_ _ \_ __ \_ _ \__ /_ _ __ `/__ __ \__ ___/ _ __ `/___ __ \__ /
/ __// /_/ // __/_ __/ / /_/ / _ / / /_(__ ) / /_/ / __ /_/ /_ /
\___/ \____/ \___/ /_/ \__,_/ /_/ /_/ /____/ \__,_/ _ .___/ /_/
/_/
```
eoefans api支持
项目主页
- [全球访问](https://portal.api.eoe.best/api-details#api=eoefans-api)
### CI/CD指南
打tag自动构建镜像,tag格式符合[语义化版本](https://semver.org/lang/zh-CN/)。([示例](https://vlink.dev/Asterism/kira-api-server/actions/runs/744))
部署请前往[eoefans api Azure deploy](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-api-azure-deploy.yml) 和 [eoefans spider Azure deploy](https://vlink.dev/EOEFANS/eoefans-api/actions/workflows/eoefans-spider-azure-deploy.yml),选择手动执行并指定tag。
发布新版时,```sentry_release```必填true或1。回滚/部署旧版时填写任意值即可。
## 环境
- golang 1.18+
- mysql 8.0+
## 目录结构
```shell
├─builder # 构建目录
│ ├─api
│ └─spider
├─cmd # 可执行文件
│ └─api
├─config # 配置文件
└─internal # 内部使用
├─app # 具体应用
│ └─api
│ ├─apperrors
│ ├─handler # http handler
│ ├─help # 助手函数
│ ├─idl # 资源定义
│ ├─middlewares # 中间件
│ ├─repository
│ ├─router # http router
│ ├─service
│ ├─spider
│ └─util 工具库
├─launcher # 基础启动器
└─pkg # 第三方依赖封装
├─bilibili
├─cache
├─config
├─database
├─httpclient
├─httpserver
├─log
└─smsclient
```
## 开始
### 本地运行
```shell
# clone repository
git clone ssh://git@ssh.git.vtb.link:7999/eoefans/eoefans-api.git
# download go mod
cd eoefans-api && go mod download
```
### Docker builder
#### builder api server
```shell
# clone repository
git clone ssh://git@ssh.git.vtb.link:7999/eoefans/eoefans-api.git
cd eoefans-api
# docker builder
# 如果在 CN 进行 build 请自行将 Dockerfile 中注释的镜像源相关行开启
docker build --rm -t eoefans-api:latest -f builder/api/Dockerfile .
# spider builder 可选的
docker build --rm -t eoefans-spider:latest -f builder/spider/Dockerfile .
# copy config file 并自行修改相关配置
cp config/config.template.yml config/api.yml
# docker run
docker run \
--detach \
--name eoefans-api \
--volume $PWD/config:/config \
eoefans-api:latest
```
## 开发者规范
### 命名规范
- 文件命名
- 全小写
- 尽可能短
- 尽量避免使用 `_`,如果一定要分割,使用 `_`
- 变量命名
- 驼峰
- 常量命名
- 驼峰
### 开发流程
[Fork & Pull Request 流程](https://aaronflower.github.io/essays/github-fork-pull-workflow.html)
- fork repository
- checkout develop -> feature
- coding
- pull request
- review
- merge
### 提交说明
- feature: 新增 feature
- fix: 修复 bug
- hotfix: 紧急修复 bug
- docs: 仅仅修改了文档,比如 README, CHANGELOG, CONTRIBUTE等等
- style: 仅仅修改了空格、格式缩进、逗号等等,不改变代码逻辑
- refactor: 代码重构,对外行为保持一致(你最好没有搞出新bug)
- perf: 优化相关,比如提升性能、体验
- test: 测试用例,包括单元测试、集成测试等
- chore: 改变构建流程、或者增加依赖库、工具等
- revert: 回滚到上一个版本
### 相关工具
- [apifox](https://www.apifox.cn/)
- 注册后联系管理者加组