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')]); }