修改数据库配置

This commit is contained in:
Yakumo Hokori
2026-02-25 22:58:50 +08:00
parent 1b36901a70
commit a89288630f
6 changed files with 327 additions and 36 deletions

View File

@@ -156,15 +156,34 @@ pnpm tauri build
## 配置说明
### 数据库配置
数据库连接配置位于 `src-tauri/src/lib.rs`
```rust
let db_url = "postgres://tmstools:521707@honulla.com:5432/tmstools";
本应用使用 **PostgreSQL** 数据库进行数据持久化存储。数据库连接配置通过本地配置文件管理。
#### 配置文件位置
所有平台统一使用 `~/.config/` 目录:
- **macOS**: `~/.config/tms_tools/config.toml`
- **Windows**: `~/.config/tms_tools/config.toml`
- **Linux**: `~/.config/tms_tools/config.toml`
#### 配置文件格式
在启动应用前,需要手动创建配置文件:
```toml
database_url = "postgres://用户名:密码@主机地址:端口/数据库名"
```
### 外部 API
- 登录接口: `https://c.baobaot.com/user/ajax_login`
- 工单平台: `https://c.baobaot.com/cinema/workorder`
**示例:**
```toml
database_url = "postgres://tmstools:521707@localhost:5432/tmstools"
```
#### 启动检查
应用启动时会自动检查配置文件:
- ✅ 配置文件存在且格式正确 → 正常启动
- ❌ 配置文件不存在 → 弹出错误提示,点击确定后退出
- ❌ 数据库连接失败 → 在登录时提示错误
## 开发计划