feat(serv): 初始化数据库连接并集成SeaORM

- 添加 SeaORM 依赖并配置工作区共享
- 替换原有的 r2d2 数据库连接池实现
- 实现异步数据库初始化函数 init_database
- 在主函数中初始化数据库并注入应用上下文
- 移除旧的 sqlite 模块和相关路由配置文件
- 更新日志模块引用并增强环境变量打印测试
- 新增运行时信息打印工具模块 progress_running_info
- 调整模块结构,移除冗余的 router 模块定义
- 修正单元测试模块引用路径及内容适配新架构
This commit is contained in:
hz
2025-12-05 18:24:50 +08:00
parent bb01f99fc0
commit 144d13a1e9
15 changed files with 53 additions and 47 deletions

View File

@@ -9,4 +9,5 @@ serde.workspace = true
serde_json.workspace = true
tokio.workspace = true
hutils.workspace = true
log = "0.4.28"
log.workspace = true
sea-orm.workspace = true

View File

@@ -0,0 +1,4 @@
### 获取银行卡列表
GET http://localhost:8080/bank_card
###

View File

@@ -1,5 +1,6 @@
use actix_web::{delete, get, post, web};
use log::info;
use sea_orm::DatabaseConnection;
pub fn bank_card_router_configure(cfg: &mut web::ServiceConfig) {
cfg
@@ -8,7 +9,7 @@ pub fn bank_card_router_configure(cfg: &mut web::ServiceConfig) {
.service(delete_bank_card);
}
#[get("/bank-card")]
pub async fn get_bank_card() -> String {
pub async fn get_bank_card(db: web::Data<DatabaseConnection>) -> String {
info!("this is get bank card");
String::from("Bill Get")
}