From 8dcf23d7e4cb28a80f0a6ff4a4ec9f7f8618f5b7 Mon Sep 17 00:00:00 2001 From: lkddi Date: Sun, 1 Mar 2026 11:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=8D=95=E6=AC=A1?= =?UTF-8?q?=E4=B8=8A=E9=99=90=E4=B8=89=E6=80=81=E9=80=BB=E8=BE=91=EF=BC=88?= =?UTF-8?q?null=3D=E4=B8=8D=E9=99=90/-1=3D=E4=B8=8D=E9=99=90/0=3D=E7=A6=81?= =?UTF-8?q?=E6=AD=A2/=E6=AD=A3=E6=95=B4=E6=95=B0=3D=E6=9C=89=E4=B8=8A?= =?UTF-8?q?=E9=99=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit frame.blade.php: - max_reward=null → myMaxReward=-1(不限,有权限) - max_reward=0 → myMaxReward=0(禁止发放) - max_reward=N → myMaxReward=N(有具体上限) user-actions.blade.php: - 按钮显示条件:myMaxReward !== 0(-1 和正整数都显示) - 面板上限文字:-1 显示「不限」,正整数显示具体数值 - sendReward 校验:0=禁止阻断,-1=不限跳过上限校验,N=有上限 - 输入框 :max:-1 时上限 999999(实际不限),N 时上限 N --- resources/views/chat/frame.blade.php | 6 +++++- .../chat/partials/user-actions.blade.php | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/resources/views/chat/frame.blade.php b/resources/views/chat/frame.blade.php index a3a8123..aa9f4e6 100644 --- a/resources/views/chat/frame.blade.php +++ b/resources/views/chat/frame.blade.php @@ -46,7 +46,11 @@ chatBotClearUrl: "{{ route('chatbot.clear') }}", chatBotEnabled: {{ \App\Models\Sysparam::getValue('chatbot_enabled', '0') === '1' ? 'true' : 'false' }}, hasPosition: {{ Auth::user()->activePosition || Auth::user()->user_level >= $superLevel ? 'true' : 'false' }}, - myMaxReward: {{ Auth::user()->activePosition?->position?->max_reward ?? 0 }}, + myMaxReward: @php + $pos = Auth::user()->activePosition?->position; + // -1 = 有权限但无上限(null),0 = 禁止,正整数 = 有具体上限 + echo $pos ? ($pos->max_reward === null ? -1 : (int) $pos->max_reward) : 0; + @endphp, appointPositionsUrl: "{{ route('chat.appoint.positions') }}", appointUrl: "{{ route('chat.appoint.appoint') }}", revokeUrl: "{{ route('chat.appoint.revoke') }}", diff --git a/resources/views/chat/partials/user-actions.blade.php b/resources/views/chat/partials/user-actions.blade.php index 057f4ea..c8e1af6 100644 --- a/resources/views/chat/partials/user-actions.blade.php +++ b/resources/views/chat/partials/user-actions.blade.php @@ -473,7 +473,13 @@ this.$alert('请输入有效的奖励金额', '提示', '#f59e0b'); return; } - if (amount > maxOnce) { + // 0 = 禁止(前端按钮不显示,此处二次保护) + if (maxOnce === 0) { + this.$alert('你的职务没有奖励发放权限', '无权限', '#cc4444'); + return; + } + // -1 = 不限,跳过上限校验;正整数 = 有具体上限 + if (maxOnce > 0 && amount > maxOnce) { this.$alert(`单次奖励上限为 ${maxOnce} 金币`, '超出上限', '#cc4444'); return; } @@ -674,8 +680,8 @@ 🎁 送礼物 - {{-- 送金币按钮:仅职务持有者且有 max_reward 时显示 --}} - @@ -750,7 +758,8 @@