From a996498a3001f12b5058628c402b74164c96e8d4 Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Sun, 10 Jul 2022 10:29:54 +0300 Subject: [PATCH] =?UTF-8?q?!=20MQ=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D1=8B=D0=B5=20=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=B8=D0=B7=20=D1=8D?= =?UTF-8?q?=D0=BA=D1=81=D0=BF=D0=B5=D1=80=D0=B8=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/threads.php | 19 +++++++++++++------ core/lib/Core/Models/DB.class.php | 1 + core/lib/Core/Models/MQ.class.php | 14 ++++---------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/admin/threads.php b/admin/threads.php index 04cfeda..65bc6c0 100644 --- a/admin/threads.php +++ b/admin/threads.php @@ -94,12 +94,17 @@ - -
-
-

Задания в очереди

+ +
+
+
+
+

Очередь

+

Список текущих заданий очереди

+
+
- +
@@ -136,7 +141,7 @@ } elseif($task['active'] === MQ::VALUE_Y && $task['in_progress'] === MQ::VALUE_N) { echo 'alert-info'; } - ?>"> + ?>"> @@ -159,8 +164,10 @@
RUN' : '';?>
+
+
\ No newline at end of file diff --git a/core/lib/Core/Models/DB.class.php b/core/lib/Core/Models/DB.class.php index edb31c1..48050db 100644 --- a/core/lib/Core/Models/DB.class.php +++ b/core/lib/Core/Models/DB.class.php @@ -193,6 +193,7 @@ try { $stmt = $this->db->query($sql); } catch (\Throwable $t) { + sendTelegram('SQL ERROR: ' . $sql); throw new CoreException('В SQL запросе произошла ошибка', CoreException::ERROR_SQL_QUERY); } $this->lastInsertId = $this->db->lastInsertId() ?? null; diff --git a/core/lib/Core/Models/MQ.class.php b/core/lib/Core/Models/MQ.class.php index d41a7bd..c1667ae 100644 --- a/core/lib/Core/Models/MQ.class.php +++ b/core/lib/Core/Models/MQ.class.php @@ -268,12 +268,6 @@ */ private function getActiveTasks(): ?array { - /*$res = $this->DB->query('SELECT * FROM ' . self::TABLE . ' WHERE active="' . self::VALUE_Y . '" AND in_progress="' . self::VALUE_N . '" ORDER BY priority, id ASC'); - if($res) { - return $res; - } else { - return null; - }*/ return $this->DB->getItems( self::TABLE, [ 'active' => self::VALUE_Y, @@ -290,7 +284,7 @@ * @return void * @throws CoreException */ - private function setTasksActiveStatus() + private function setTasksActiveStatus(): void { $countTasks = $this->getActiveTasksCount(); @@ -375,7 +369,7 @@ * * @param int $priority Приоритет * - * @return void + * @return MQ */ public function setPriority(int $priority): self { @@ -390,7 +384,7 @@ * @param string $method Метод класса * @param ?array $params Массив параметров * - * @return int|null Идентификатор созданного задания + * @return \Core\Models\MQResponse Идентификатор созданного задания * @throws CoreException */ public function createTask(?string $class = null, string $method, ?array $params = null): MQResponse @@ -494,7 +488,7 @@ if (USE_LOG) { Log::logToFile( - 'Заданиt ' . $taskId . ' взято в работу', + 'Задание ' . $taskId . ' взято в работу', self::LOG_FILE, ['taskId' => $taskId], LOG_DEBUG