Initial commit: Auto-Finance 财务报销自动化系统

This commit is contained in:
wandering
2026-05-25 11:18:12 +08:00
commit f754386695
25 changed files with 3040 additions and 0 deletions

33
app/config.py Normal file
View File

@@ -0,0 +1,33 @@
"""
配置加载
从项目根目录的 config.json 读取配置,返回结构化的配置字典。
"""
import json
from pathlib import Path
_CONFIG_PATH = Path(__file__).parent.parent / "config.json"
def load_config() -> dict:
"""加载并合并配置,缺失字段使用默认值"""
raw = {}
if _CONFIG_PATH.exists():
with open(_CONFIG_PATH, encoding="utf-8") as f:
raw = json.load(f)
project_root = _CONFIG_PATH.parent
return {
"sso_login_url": raw.get("sso_login_url", "https://tyrz.fynu.edu.cn/sso/login"),
"portal_url": raw.get("portal_url", "https://tyrz.fynu.edu.cn/oshall"),
"reimburse_url": raw.get("reimburse_url", "http://210.45.32.214:8081"),
"reimburse_page": raw.get("reimburse_page", "/expen/common/common?v=4.0"),
"username": raw.get("username", ""),
"password": raw.get("password", ""),
"default_name": raw.get("default_name", ""),
"default_card_no": raw.get("default_card_no", ""),
"default_person_id": raw.get("default_person_id", ""),
"attachment_dir": project_root / "attachments",
}