From dfd4156aef28bfe2363decece57e70361a5b7852 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 13 Feb 2023 20:32:00 +0800 Subject: [PATCH] feat: email send priority --- db/app_uoj233.sql | 3 ++- web/app/controllers/forgot_pw.php | 2 +- web/app/libs/uoj-utility-lib.php | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/db/app_uoj233.sql b/db/app_uoj233.sql index 70b46ed..45fd58e 100644 --- a/db/app_uoj233.sql +++ b/db/app_uoj233.sql @@ -444,7 +444,8 @@ CREATE TABLE `emails` ( `send_time` datetime DEFAULT NULL, `priority` int NOT NULL DEFAULT 0, PRIMARY KEY (`id`), - KEY `send_time` (`send_time`) + KEY `send_time` (`send_time`), + KEY `priority` (`priority`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/web/app/controllers/forgot_pw.php b/web/app/controllers/forgot_pw.php index 5488b48..32cac41 100644 --- a/web/app/controllers/forgot_pw.php +++ b/web/app/controllers/forgot_pw.php @@ -72,7 +72,7 @@ $forgot_form->handle = function (&$vdata) {
  • 转发源 IP:{$http_x_forwarded_for}
  • 用户代理: {$user_agent}
  • - EOD); + EOD, 5); DB::update([ "update user_info", diff --git a/web/app/libs/uoj-utility-lib.php b/web/app/libs/uoj-utility-lib.php index a4e69e7..ed0aa05 100644 --- a/web/app/libs/uoj-utility-lib.php +++ b/web/app/libs/uoj-utility-lib.php @@ -210,11 +210,11 @@ function sendSystemMsg($username, $title, $content) { sendEmail($username, $title, $content); } -function sendEmail($username, $title, $content) { +function sendEmail($username, $title, $content, $priority = 0) { DB::insert([ "insert into emails", - "(receiver, subject, content, created_at)", - "values", DB::tuple([$username, $title, $content, DB::now()]) + "(receiver, subject, content, created_at, priority)", + "values", DB::tuple([$username, $title, $content, DB::now(), $priority]) ]); }