fix: 修复微信账单金额解析问题(半角¥符号支持)
- 修复 parse_amount 函数同时支持全角¥和半角¥ - 新增 MonthRangePicker 日期选择组件 - 新增 /api/monthly-stats 接口获取月度统计 - 分析页面月度趋势使用全量数据 - 新增健康检查路由
This commit is contained in:
@@ -25,9 +25,10 @@ def parse_date(date_str: str) -> date:
|
||||
|
||||
|
||||
def parse_amount(amount_str: str) -> Decimal:
|
||||
"""解析金额字符串为Decimal(去掉¥符号)"""
|
||||
"""解析金额字符串为Decimal(去掉¥/¥符号)"""
|
||||
try:
|
||||
clean = amount_str.replace("¥", "").replace(" ", "").strip()
|
||||
# 同时处理全角¥和半角¥
|
||||
clean = amount_str.replace("¥", "").replace("¥", "").replace(" ", "").strip()
|
||||
return Decimal(clean)
|
||||
except:
|
||||
return Decimal("0")
|
||||
|
||||
@@ -218,6 +218,7 @@
|
||||
- 煲仔饭
|
||||
- 蛙来哒 # 牛蛙餐厅
|
||||
- 粒上皇 # 炒货零食店
|
||||
- 盒马
|
||||
|
||||
# 转账红包
|
||||
转账红包:
|
||||
|
||||
@@ -25,6 +25,9 @@ from cleaners.base import compute_date_range_from_values
|
||||
from cleaners import AlipayCleaner, WechatCleaner
|
||||
from category import infer_category, get_all_categories, get_all_income_categories
|
||||
|
||||
# 应用版本
|
||||
APP_VERSION = "0.0.1"
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Pydantic 模型
|
||||
@@ -183,7 +186,7 @@ app = FastAPI(
|
||||
@app.get("/health", response_model=HealthResponse)
|
||||
async def health_check():
|
||||
"""健康检查"""
|
||||
return HealthResponse(status="ok", version="1.0.0")
|
||||
return HealthResponse(status="ok", version=APP_VERSION)
|
||||
|
||||
|
||||
@app.post("/clean", response_model=CleanResponse)
|
||||
|
||||
Reference in New Issue
Block a user