From 34843b66344d6ce0cb305ca8a0395c420328117f Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 29 Jun 2026 16:58:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4NaN/nan/null/=E7=A9=BA?= =?UTF-8?q?=E5=80=BC=E9=98=B2MySQL=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/discount_setting/save_discount.dspy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wwwroot/discount_setting/save_discount.dspy b/wwwroot/discount_setting/save_discount.dspy index fca532e..2111bc0 100644 --- a/wwwroot/discount_setting/save_discount.dspy +++ b/wwwroot/discount_setting/save_discount.dspy @@ -13,6 +13,17 @@ try: if not discountid or not productid: raise Exception('缺少必要参数: discountid, productid') + # 过滤 NaN 和空值 + if discount_val is not None: + s = str(discount_val).strip().lower() + if s in ('', 'nan', 'none', 'null'): + discount_val = None + + if old_discount is not None: + s = str(old_discount).strip().lower() + if s in ('', 'nan', 'none', 'null'): + old_discount = None + # 对比新旧值,相同则跳过 if discount_val is not None and old_discount is not None: try: