支付系统核心:配额限制与用户付费状态管理

- 添加 tokio 依赖用于异步测试
- 启用 User 结构体,添加 is_paid/is_admin/paid_expires_at 字段
- 添加 UpdatePaymentRequest 请求体
- insert_weather_data 集成配额检查逻辑
- 新增 get_user_by_id、count_user_weather_data、update_user_payment_status
- 添加 payment_fields 数据库迁移脚本
This commit is contained in:
2026-03-25 13:17:36 +08:00
parent 63b6d5df8f
commit 484146aba9
5 changed files with 117 additions and 19 deletions

13
Cargo.lock generated
View File

@@ -2079,6 +2079,7 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
"tokio",
]
[[package]]
@@ -2718,9 +2719,21 @@ dependencies = [
"signal-hook-registry",
"slab",
"socket2 0.6.0",
"tokio-macros",
"windows-sys 0.59.0",
]
[[package]]
name = "tokio-macros"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tokio-native-tls"
version = "0.3.1"