功能:id=1 超管无需职务即可发放奖励金币

前端(frame.blade.php):
- Auth::id()===1 时 myMaxReward=-1(不限),送金币按钮始终显示

后端(AdminCommandController::reward):
- isSuperAdmin=true 时跳过职务检查和①②③④限额校验
- 全局接收次数⑤对超管同样生效(防止刷奖励)
- 履职记录 user_position_id 允许 null(超管无职务时)
- 发放备注改用 positionName 变量(超管显示「超级管理员」)

顺带修复:②操作人单日累计统计之前误查 target_user_id,
已改为正确的 user_id(操作人自己今日已发总额)
This commit is contained in:
2026-03-01 11:43:51 +08:00
parent cc1278ffcb
commit 3d30d7e811
2 changed files with 64 additions and 49 deletions
+8 -3
View File
@@ -47,9 +47,14 @@
chatBotEnabled: {{ \App\Models\Sysparam::getValue('chatbot_enabled', '0') === '1' ? 'true' : 'false' }},
hasPosition: {{ Auth::user()->activePosition || Auth::user()->user_level >= $superLevel ? 'true' : 'false' }},
myMaxReward: @php
$pos = Auth::user()->activePosition?->position;
// -1 = 有权限但无上限(null),0 = 禁止,正整数 = 有具体上限
echo $pos ? ($pos->max_reward === null ? -1 : (int) $pos->max_reward) : 0;
if (Auth::id() === 1) {
// 超级管理员(id=1)无需职务,直接拥有不限量奖励权
echo -1;
} else {
$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') }}",