From 41d4acdd72bdacbc9fe4d4759809a6fd32ec2fa6 Mon Sep 17 00:00:00 2001 From: lkddi Date: Sun, 1 Mar 2026 11:11:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=81=8C=E5=8A=A1?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=A1=A8=E5=8D=95=E4=B8=AD=200=20=E5=80=BC?= =?UTF-8?q?=E8=A2=AB=20||=20''=20=E8=AF=AF=E8=BD=AC=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit openEdit() 中三个奖励字段从 OR 运算符改为显式 null 检查: - max_reward: pos.max_reward !== null ... - daily_reward_limit 同上 - recipient_daily_limit 同上 - max_persons 改用 JS ?? 空值合并运算符 根本原因:0 在 JS 中是 falsy,pos.max_reward || '' 会将 0 变成 '', 提交到后端后 nullable 规则将空字符串解析为 null 覆盖掉用户的 0 设置。 --- resources/views/admin/positions/index.blade.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/admin/positions/index.blade.php b/resources/views/admin/positions/index.blade.php index a07df18..57d83cd 100644 --- a/resources/views/admin/positions/index.blade.php +++ b/resources/views/admin/positions/index.blade.php @@ -44,10 +44,10 @@ icon: pos.icon || '', rank: pos.rank, level: pos.level, - max_persons: pos.max_persons || '', - max_reward: pos.max_reward || '', - daily_reward_limit: pos.daily_reward_limit || '', - recipient_daily_limit: pos.recipient_daily_limit || '', + max_persons: pos.max_persons ?? '', + max_reward: pos.max_reward !== null && pos.max_reward !== undefined ? pos.max_reward : '', + daily_reward_limit: pos.daily_reward_limit !== null && pos.daily_reward_limit !== undefined ? pos.daily_reward_limit : '', + recipient_daily_limit: pos.recipient_daily_limit !== null && pos.recipient_daily_limit !== undefined ? pos.recipient_daily_limit : '', sort_order: pos.sort_order, }; this.showForm = true;