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

This commit is contained in:
兔姬桑
2021-01-27 00:59:18 -05:00
parent c256c8e8e7
commit c68087c54b
3 changed files with 5 additions and 17 deletions

View File

@@ -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);
}

View File

@@ -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)));
}
}
}

View File

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