diff --git a/controllers/ApiController.php b/controllers/ApiController.php index 5f2dd819..576f2483 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -78,7 +78,7 @@ class ApiController extends Controller { "Staff" => $post["id"], "Time" => $time, "Image" => $fileName, - "Confidence" => strval($post["confidence"]) + "Confidence" => json_encode($post["confidence"]) ]); $server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']); $ip = "https://dev-dc.beetai.com"; @@ -259,13 +259,21 @@ class ApiController extends Controller { ]); $updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']); } + $currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true); if ($updating->data === "true") { - $txt = "\n" . date("H:i:s d/m/Y") . " " . "updating"; - file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND); - return ["status" => false]; + if ($currentCache['n_128'] == $currentCache['n_512']) { + $updating->data = "false"; + $updating->save(); + $txt = "\n" . date("H:i:s d/m/Y") . " " . "success"; + file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND); + return ["status" => false]; + } else { + $txt = "\n" . date("H:i:s d/m/Y") . " " . "updating"; + file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND); + return ["status" => false]; + } } - $currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true); if ($currentCache['n_128'] == $currentCache['n_512']) { $txt = "\n" . date("H:i:s d/m/Y") . " " . "success"; file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND); @@ -407,6 +415,17 @@ class ApiController extends Controller { 'data' => $post['token'] ]); } + $version = \app\models\SyncUrl::findOne(['key_config' => 'version']); + if ($version) { + $token->data = $post['version']; + $token->save(); + } else { + $model = new \app\models\SyncUrl(); + $model->create([ + 'key_config' => "version", + 'data' => $post['version'] + ]); + } Yii::$app->response->format = "json"; return ["status" => true]; } diff --git a/helpers/CaptureLogsGrid.php b/helpers/CaptureLogsGrid.php index 49627a77..3bd6115d 100644 --- a/helpers/CaptureLogsGrid.php +++ b/helpers/CaptureLogsGrid.php @@ -63,7 +63,34 @@ class CaptureLogsGrid { public static function confidence() { return function($model) { - return number_format($model->confidence, 2); + $confidence = json_decode($model->confidence, true); + $person1_html = $person2_html = ""; + $person1 = \app\models\ListManagement::findOne($confidence['id1']); + if ($person1) { + $images = json_decode($person1->image, true); + $person1_html = "
" . Html::img("/data/uploads/face/" . $images[0]['url'], [ + "class" => "img-thumbnail", + "style" => "width: 100px;height:100px;" + ]) . "
" . $person1->name . " [" . $confidence['percent1'] . "]" . "
"; + } + if ($confidence['id2'] !== "0" && $confidence['id2'] != $confidence['id1']) { + $person2 = \app\models\ListManagement::findOne($confidence['id2']); + if ($person2) { + $images = json_decode($person2->image, true); + $person2_html = "
" . Html::img("/data/uploads/face/" . $images[0]['url'], [ + "class" => "img-thumbnail", + "style" => "width: 100px;height:100px;" + ]) . "
" . $person2->name . " [" . $confidence['percent2'] . "]" . "
"; + } + } + return $person1_html . $person2_html; + }; + } + + public static function confidenceControlLogs() { + return function($model) { + $confidence = json_decode($model->confidence, true); + return $confidence['percent1'] . ($confidence['percent2'] > 0 ? " [" . $confidence['percent2'] . "]" : ""); }; } diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties index 30719514..f9b3b45f 100644 --- a/nbproject/private/private.properties +++ b/nbproject/private/private.properties @@ -4,5 +4,5 @@ copy.src.target= remote.connection=BiFace-99bab6 remote.directory=/BiFace_Server_Lite remote.upload=ON_SAVE -run.as=LOCAL +run.as=REMOTE url=http://localhost/ diff --git a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/content.php b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/content.php index 02ac2e8b..7549557d 100644 --- a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/content.php +++ b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/content.php @@ -17,13 +17,17 @@ use dmstr\widgets\Alert;
- +