添加说明文件

This commit is contained in:
tone
2024-09-26 14:41:00 +08:00
parent 187723947f
commit d2c52713bf
4 changed files with 62 additions and 4 deletions

View File

@@ -27,6 +27,11 @@ npm start
## 版本说明 ## 版本说明
### v1.0.1
* 添加 数据库连接【MySQL】
* 添加 数据库连接【Redis】
* 添加 服务【Captcha】人机验证
### v1.0.0 ### v1.0.0
* 构建 基础框架 * 构建 基础框架
* 添加 API中间件【MountIP】 * 添加 API中间件【MountIP】

View File

@@ -1,7 +1,22 @@
/** /**
* @file MySQLConnection.ts * @file MySQLConnection.ts
* @version 1.0.0 * @version 1.0.1
* @description MySQL数据库连接池 * @description MySQL数据库连接池
*
* 该文件提供了MySQL数据库连接池的实现包括以下功能
* - 创建数据库连接池
* - 自动测试数据库连接
* - 数据库基础错误处理
*
* ## 配置项说明
* 在 `config.ts` 文件中,可以配置以下选项:
* - `enable`: 是否启用 MySQL 数据库
* - `host`: 数据库主机地址
* - `port`: 数据库端口号
* - `database`: 数据库名称
* - `user`: 数据库用户名
* - `password`: 数据库密码
*
*/ */
import mysql from "mysql2/promise"; import mysql from "mysql2/promise";
import Logger from "@lib/Logger/Logger"; import Logger from "@lib/Logger/Logger";

View File

@@ -1,3 +1,20 @@
/**
* @file RedisConnection.ts
* @version 1.0.1
* @description Redis数据库连接池
*
* 该文件提供了Redis数据库连接池的实现包括以下功能
* - 创建数据库连接池
* - 自动测试数据库连接
* - 导出原生Redis连接池对象注意需要自行进行错误处理
*
* ## 配置项说明
* 在 `config.ts` 文件中,可以配置以下选项:
* - `enable`: 是否启用 Redis 数据库
* - `host`: 数据库主机地址
* - `port`: 数据库端口号
* - `password`: 数据库密码,如果没有请保留空串
*/
import Redis from 'ioredis'; import Redis from 'ioredis';
import config from '../../config'; import config from '../../config';
import Logger from '@lib/Logger/Logger'; import Logger from '@lib/Logger/Logger';

View File

@@ -1,7 +1,28 @@
/** /**
* @file CaptchaSession.ts * @file CaptchaSession.ts
* @version 1.0.0 * @version 1.0.1
* @description 旋转图像验证服务 * @description 人机验证服务
*
* 该文件提供了“Session-角度”结构存储的通用验证方案
* - 存储和检索验证数据
* - 自动清理过期的验证会话
* - 允许采用本地存储的方案即允许不依赖Redis
*
* ## 配置项说明
*
* 在 `config.ts` 文件中,可以配置以下选项:
* - `useRedis`: 是否使用 Redis 存储验证数据
* - `allowMaxTryCount`: 允许的最大尝试次数
* - `allowMaxAngleDiff`: 允许的最大角度偏差
* - `expriedTimeSec`: 验证会话的过期时间(秒)
* - `allowReuseCount`: 允许check方法验证通过后重复使用isPassed方法进行验证的次数
* - `refreshExpiryOnUse`: 使用后是否刷新过期时间
*
* ## 注意事项
*
* - 请确保在 `config.ts` 文件中正确配置 Redis 和其他选项。
* - 如果使用 Redis请确保 Redis 服务已启动并可用。
* - 定期检查日志文件,以确保服务正常运行。
*/ */
import Logger from '@lib/Logger/Logger'; import Logger from '@lib/Logger/Logger';
import type { Redis } from '@lib/Database/RedisConnection'; import type { Redis } from '@lib/Database/RedisConnection';