diff --git a/fudai_detail_modules/fudai_detail_validator.py b/fudai_detail_modules/fudai_detail_validator.py index e7a3b15..e26dfaf 100644 --- a/fudai_detail_modules/fudai_detail_validator.py +++ b/fudai_detail_modules/fudai_detail_validator.py @@ -8,6 +8,7 @@ from __future__ import annotations """ from typing import Any, Tuple +import logging import re import os import json @@ -28,15 +29,18 @@ def validate_fudai_detail(detail: Tuple, analyser: Any = None) -> Tuple[bool, st time_text = str(detail[1] or "").strip() try: participants = int(detail[2] or 0) - except Exception: + except (ValueError, TypeError) as e: + logging.debug("参与人数解析失败: %r, 使用默认值0: %s", detail[2], e) participants = 0 try: copies = int(detail[3] or 0) - except Exception: + except (ValueError, TypeError) as e: + logging.debug("份数解析失败: %r, 使用默认值0: %s", detail[3], e) copies = 0 try: prize_value_yuan = float(detail[4] or 0.0) - except Exception: + except (ValueError, TypeError) as e: + logging.debug("奖品金额解析失败: %r, 使用默认值0.0: %s", detail[4], e) prize_value_yuan = 0.0 countdown_tuple = detail[5] @@ -45,8 +49,8 @@ def validate_fudai_detail(detail: Tuple, analyser: Any = None) -> Tuple[bool, st try: countdown_start = float(countdown_tuple[0] or 0.0) countdown_end = float(countdown_tuple[1] or 0.0) - except Exception: - pass + except (ValueError, TypeError) as e: + logging.debug("倒计时元组解析失败: %r: %s", countdown_tuple, e) # 检查1:内容不能为空(至少要有一些文字) # 如果运行时显式禁用了内容识别,则跳过此检查(允许内容为空)