Refactor Slack notification logic in departments_o.php and exampleRoute.php
- Update `send_webhook_message` to include custom department webhook. - Add `sendSlackInternalStatisticNotification` to handle additional statistics notifications.
This commit is contained in:
@@ -786,6 +786,6 @@ class departments_o extends db
|
||||
}
|
||||
// Send the message to the internal Slack webhook
|
||||
$slack = new slack();
|
||||
$slack->send_message($tmp);
|
||||
$slack->send_webhook_message($tmp, (new departments_o())->select(10)->slack_webhook->value());
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,9 @@ class exampleRoute
|
||||
// The time should be from 00:00:00 of the start date to 23:59:59 of the end date
|
||||
$date_end = date('Y-m-d 23:59:59', strtotime("-1 days")); // Yesterday (Sunday) at 23:59:59
|
||||
$date_start = date('Y-m-d 00:00:00', strtotime("-$days days")); // $days ago at 00:00:00
|
||||
$department->sendPeriodStatisticsToSlack($date_start, $date_end);
|
||||
$department->sendPeriodStatisticsToSlack($date_start, $date_end); // Sends message to "daglig-ledelse".
|
||||
}
|
||||
$department->sendSlackInternalStatisticNotification($date_start, $date_end, $departments);
|
||||
}
|
||||
}
|
||||
$response->success(['message' => 'Hello World!']);
|
||||
|
||||
Reference in New Issue
Block a user