瀏覽代碼

丢弃部分通知代码,待User表添加各人通知渠道信息

兔姬桑 4 年之前
父節點
當前提交
c68087c54b

+ 2 - 6
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);
         }

+ 1 - 3
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)));
                 }
             }
         }

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