fix bug empty logs

This commit is contained in:
dongpd 2023-06-19 11:30:46 +07:00
parent 82a5b0d0ad
commit e4e080266a

View File

@ -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"];
}