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: