From 237f658e1651563ea062905a520c3b4e03bf95c3 Mon Sep 17 00:00:00 2001 From: dongpd Date: Fri, 11 Dec 2020 15:11:26 +0700 Subject: [PATCH] =?UTF-8?q?update=20script=20=C4=91=E1=BB=93ng=20b?= =?UTF-8?q?=E1=BB=99=20d=E1=BB=AF=20li=E1=BB=87u=20t=E1=BB=9Bi=20m=C3=A1y?= =?UTF-8?q?=20ch=E1=BB=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/SyncController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/commands/SyncController.php b/commands/SyncController.php index a8f134fb..b22fbbeb 100644 --- a/commands/SyncController.php +++ b/commands/SyncController.php @@ -12,6 +12,7 @@ use yii\console\Controller; use yii\console\ExitCode; use app\models\CaptureLogs; use app\models\ListManagement; +use Yii; /** * This command echoes the first argument that you have entered. @@ -38,8 +39,7 @@ class SyncController extends Controller { $id_camera = 209; if ($device_id) $id_camera = intval($device_id->data); - - $ls = CaptureLogs::find()->andWhere(['<>', 'staff_id', 0])->andWhere(['sync_status' => 0])->all(); + $ls = CaptureLogs::find()->andWhere(['<>', 'staff_id', 0])->andWhere(['sync_status' => null])->all(); foreach ($ls as $key => $value) { $staffInfo = ListManagement::findOne($value->staff_id); $res = json_decode(file_get_contents("https://" . $ip . "/api/box/oem_face_recognition", false, stream_context_create([ @@ -47,10 +47,12 @@ class SyncController extends Controller { 'header' => "Content-Type: application/json", 'method' => "POST", 'content' => json_encode([ - 'image' => base64_encode(file_get_contents(Yii::getAlias('@webroot') . "/data/uploads/face/" . $value->image)), + 'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)), 'camera_id' => strval($id_camera), - 'frametime' => date("Y-m-d H:i:s", $value->time), - 'idCard' => $staffInfo ? strval($staffInfo->code) : "0" + 'frametime' => date("Y-m-d H:i:s", $value->time + 60 * 60 * 7), + 'idCard' => $staffInfo ? strval($staffInfo->code) : "0", + "person_id" => "123", + "timezone" => "+7" ]) ] ])), true);