feat: replace Redis with PostgreSQL for caching, rate limiting, SMS codes, and token blacklist

- Add 4 PG entities: VerificationCode, RateLimitEntry, TokenBlacklistEntry, CacheEntry
- Add 4 services: VerificationService, RateLimitService, TokenBlacklistService, CacheService
- Add CleanupBackgroundService for periodic expired data cleanup
- Add MigrationHelper for safe schema migration without data loss
- Update AuthController: real SMS code generation, rate limiting, logout endpoint with JWT blacklist
- Update JwtProvider: add JTI claim for token revocation
- Update Program.cs: register new services, JWT blacklist validation, DB migration
- Remove StackExchange.Redis NuGet package and all Redis config references
- Update start-dev.bat: 6→5 services, remove Redis startup
- Update docs: remove Redis references from all documentation
- Fix: logout button spacing on profile page
- Fix: .gitignore data/→/data/ to not ignore Infrastructure/Data/
This commit is contained in:
MingNian
2026-05-26 13:48:53 +08:00
parent 39ab6062b5
commit d5f167167a
25 changed files with 613 additions and 47 deletions

View File

@@ -34,16 +34,13 @@ D:\APP\start-dev.bat
HealthManager 开发环境启动
==========================================
[1/4] 启动 PostgreSQL...
[1/3] 启动 PostgreSQL...
PostgreSQL 已启动
[2/4] 启动 Redis...
Redis 已启动
[3/4] 启动 MinIO...
[2/3] 启动 MinIO...
MinIO 已启动
[4/4] 启动后端 API...
[3/3] 启动后端 API...
后端 API 启动中 (http://localhost:5000)
Swagger: http://localhost:5000/swagger
@@ -54,7 +51,6 @@ D:\APP\start-dev.bat
Swagger: http://localhost:5000/swagger
MinIO: http://localhost:9001
PostgreSQL: localhost:5432
Redis: localhost:6379
===========================================
```
@@ -105,9 +101,9 @@ VITE v8.x.x ready in xxx ms
### 1.2 关闭系统
1. 关闭三个命令行窗口(后端、患者前端、医生前端)
2. PostgreSQL、Redis、MinIO 会继续在后台运行。如果想关闭它们:
2. PostgreSQL、MinIO 会继续在后台运行。如果想关闭它们:
- 打开任务管理器Ctrl+Shift+Esc
- 找到 `postgres.exe``redis-server.exe``minio.exe` 进程
- 找到 `postgres.exe``minio.exe` 进程
- 分别结束任务
---
@@ -861,8 +857,6 @@ VITE v8.x.x ready in xxx ms
| 医生前端 | http://localhost:5174 |
| MinIO 控制台 | http://localhost:9001 |
| PostgreSQL | localhost:5432 |
| Redis | localhost:6379 |
### 5.3 常见问题
**Q登录失败怎么办**