fix: 充值金额用rules校验(min+number)替代无效的min属性 + 后端NaN防护

This commit is contained in:
Hermes Agent 2026-06-23 15:29:51 +08:00
parent e17a9ac58b
commit 511f4b0720
2 changed files with 5 additions and 2 deletions

View File

@ -52,7 +52,10 @@
"uitype": "float", "uitype": "float",
"required": true, "required": true,
"placeholder": "输入充值金额", "placeholder": "输入充值金额",
"min": 0.01, "rules": [
{"type": "number", "message": "充值金额必须是有效数字"},
{"type": "min", "value": 0.01, "message": "充值金额必须大于0"}
],
"cwidth": 20 "cwidth": 20
} }
] ]

View File

@ -57,7 +57,7 @@ except (ValueError, TypeError):
"options": {"text": "❌ 充值金额格式错误", "color": "#EF4444"} "options": {"text": "❌ 充值金额格式错误", "color": "#EF4444"}
} }
if amount <= 0: if amount != amount or amount <= 0:
return { return {
"widgettype": "Text", "widgettype": "Text",
"options": {"text": "❌ 充值金额必须大于0", "color": "#EF4444"} "options": {"text": "❌ 充值金额必须大于0", "color": "#EF4444"}