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 @@