From e4e080266a0f6bb98368568d04d2dacea5ba8787 Mon Sep 17 00:00:00 2001 From: dongpd Date: Mon, 19 Jun 2023 11:30:46 +0700 Subject: [PATCH] fix bug empty logs --- controllers/ApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/ApiController.php b/controllers/ApiController.php index 47f28d86..0b85df9d 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -75,7 +75,7 @@ class ApiController extends Controller { $lastLogs->delete(); } $lastLogs = CaptureLogs::find()->andWhere(["staff_id" => $post['id']])->orderBy(["time" => SORT_DESC])->limit(1)->one(); - if (($time - $lastLogs->time) < 1) { + if ($lastLogs && ($time - $lastLogs->time) < 1) { file_put_contents("log_connect_server.txt", "\n[" . date("H:i:s d/m/Y") . "] duplicate face " . $post["id"], FILE_APPEND); return ["status" => "success"]; }