Skip to content

Commit

Permalink
use CalendarAlertService
Browse files Browse the repository at this point in the history
  • Loading branch information
techloghub committed Aug 14, 2023
1 parent 1c6cdc3 commit e111d97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 3 additions & 4 deletions regular/calendars_alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require_once(__DIR__.'/../app/register.php');
\date_default_timezone_set('PRC');

$date = date('Y-m-d H:i:s');
$params = array('le' => array('next_time' => $date), 'ne' => array('status' => '2'));
$calendars = Repository::findFromCalendarAlert($params);

Expand All @@ -14,10 +15,8 @@
if (!empty($calendar->get_remark())) {
$content .= '<p>备注:</p><p><blockquote>' . $calendar->get_remark() . '</blockquote></p>';
}
file_get_contents('https://techlog.cn/mail/list'
.'?html=1&subject='.$subject.'&content='.$content.'&[email protected]');
CalendarAlertService::send_mail($subject, '[email protected]', $content);
}
file_get_contents('http://admin.techlog.cn/app_dev.php/api/calendar/setalerttime?'
.'calendar_id='.$calendar->get_id());
CalendarAlertService::update_next_alert_time($calendar->get_id());
}
?>
5 changes: 1 addition & 4 deletions tools/mail.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?php
require_once (__DIR__.'/../app/register.php');

use PHPMailer\PHPMailer\PHPMailer;

$options = getopt('s:t:c:h:a:');
if (!isset($options['t']) || !isset($options['s']) || !isset($options['c']))
{
if (!isset($options['t']) || !isset($options['s']) || !isset($options['c'])) {
echo 'usage: php mail.php'
.' -s subject -t to -c content'
.' [-h is html([0]/1)] [-a alt content]'.PHP_EOL;
Expand Down

0 comments on commit e111d97

Please sign in to comment.