From c68087c54b8f4bb65a02bb65404977bc6bc5f621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=A7=AC=E6=A1=91?= Date: Wed, 27 Jan 2021 00:59:18 -0500 Subject: [PATCH] =?UTF-8?q?=E4=B8=A2=E5=BC=83=E9=83=A8=E5=88=86=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=BE=85User=E8=A1=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=84=E4=BA=BA=E9=80=9A=E7=9F=A5=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/NodeStatusDetection.php | 8 ++------ app/Console/Commands/UserHourlyTrafficMonitoring.php | 4 +--- app/Http/Controllers/UserController.php | 10 ++-------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/app/Console/Commands/NodeStatusDetection.php b/app/Console/Commands/NodeStatusDetection.php index 8495cce5..a405e895 100644 --- a/app/Console/Commands/NodeStatusDetection.php +++ b/app/Console/Commands/NodeStatusDetection.php @@ -67,9 +67,7 @@ class NodeStatusDetection extends Command } if (isset($data)) { - Notification::send(User::permission('admin.node.edit,update')->orWhere(function ($query) { - return $query->role('Super Admin'); - })->get(), new NodeOffline($data)); + Notification::send(User::find(1), new NodeOffline($data)); } } @@ -134,9 +132,7 @@ class NodeStatusDetection extends Command } if ($sendText) {//只有在出现阻断线路时,才会发出警报 - Notification::send(User::permission('admin.node.edit,update')->orWhere(function ($query) { - return $query->role('Super Admin'); - })->get(), new NodeBlocked($message.$additionalMessage)); + Notification::send(User::find(1), new NodeBlocked($message.$additionalMessage)); Log::info("阻断日志: \r\n".$message.$additionalMessage); } diff --git a/app/Console/Commands/UserHourlyTrafficMonitoring.php b/app/Console/Commands/UserHourlyTrafficMonitoring.php index 595a0a87..9aebdbe8 100644 --- a/app/Console/Commands/UserHourlyTrafficMonitoring.php +++ b/app/Console/Commands/UserHourlyTrafficMonitoring.php @@ -59,9 +59,7 @@ class UserHourlyTrafficMonitoring extends Command if ($this->data_anomaly_notification) { // 用户流量异常警告 $traffic = $user->hourlyDataFlows()->whereNodeId(null)->latest()->first(); if ($traffic->total >= $this->traffic_ban_value) { - Notification::send(User::permission('admin.user.edit,update')->orWhere(function ($query) { - return $query->role('Super Admin'); - })->get(), new DataAnomaly($user->id, flowAutoShow($traffic->u), flowAutoShow($traffic->d), flowAutoShow($traffic->traffic))); + Notification::send(User::find(1), new DataAnomaly($user->id, flowAutoShow($traffic->u), flowAutoShow($traffic->d), flowAutoShow($traffic->traffic))); } } } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index c1f1fdc3..a160e95e 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -284,10 +284,7 @@ class UserController extends Controller if ($ticket = $user->tickets()->create(compact('title', 'content'))) { // 通知相关管理员 - Notification::send(User::permission('admin.ticket.edit,update')->orWhere(function ($query) { - return $query->role('Super Admin'); - })->get(), - new TicketCreated($ticket->title, $ticket->content, route('admin.ticket.edit', $ticket))); + Notification::send(User::find(1), new TicketCreated($ticket->title, $ticket->content, route('admin.ticket.edit', $ticket))); return Response::json(['status' => 'success', 'message' => trans('common.submit_item', ['attribute' => trans('common.success')])]); } @@ -321,10 +318,7 @@ class UserController extends Controller $ticket->save(); // 通知相关管理员 - Notification::send(User::permission('admin.ticket.edit,update')->orWhere(function ($query) { - return $query->role('Super Admin'); - })->get(), - new TicketReplied($ticket->title, $content, route('admin.ticket.edit', $ticket))); + Notification::send(User::find(1), new TicketReplied($ticket->title, $content, route('admin.ticket.edit', $ticket))); return Response::json(['status' => 'success', 'message' => trans('user.ticket.reply').trans('common.success')]); }