diff --git a/controllers/ApiController.php b/controllers/ApiController.php index 41f77dd8..9b8c4021 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -109,7 +109,8 @@ class ApiController extends Controller { 'method' => "POST", 'content' => json_encode([ 'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName)), - 'data' => common::rsaEncode($text) + 'data' => common::rsaEncode($text), + 'confidence' => isset($post["confidence"]["percent1"]) ? $post["confidence"]["percent1"] : 0 ]) ] ])), true); @@ -149,7 +150,7 @@ class ApiController extends Controller { } $allFeatures[] = [ "id" => $value->id, - "object_id" => $value->staff_id, + "object_id" => $value->staff_id, "name" => $this->convert_vi_to_en($value->name), "feature1" => $feature1, "feature2" => $feature2 @@ -353,6 +354,7 @@ class ApiController extends Controller { foreach ($ls as $key => $value) { if (file_exists("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)) { $staffInfo = ListManagement::findOne($value->staff_id); + $confidence = json_decode($value->confidence, true); $res = json_decode(file_get_contents($ip . "/api/oem/face_recognition?token=" . $tk, false, stream_context_create([ 'http' => [ 'header' => "Content-Type: application/json", @@ -364,7 +366,8 @@ class ApiController extends Controller { 'idCard' => $staffInfo ? strval($staffInfo->code) : "0", 'idObject' => $staffInfo ? $staffInfo->staff_id : "", "person_id" => "123", - "timezone" => "+7" + "timezone" => "+7", + 'confidence' => isset($confidence['percent1']) ? floatval($confidence['percent1']) : 0 ]) ] ])), true); diff --git a/controllers/CaptureLogsController.php b/controllers/CaptureLogsController.php index 11579019..1f1b8cda 100644 --- a/controllers/CaptureLogsController.php +++ b/controllers/CaptureLogsController.php @@ -117,4 +117,39 @@ class CaptureLogsController extends Controller { throw new NotFoundHttpException(Yii::t("app", "KHONG_TIM_THAY_THONG_TIN")); } + public function actionFaceComparison() { + if (Yii::$app->request->post()) { + $post = Yii::$app->request->post(); + Yii::$app->response->format = "json"; + $results = json_decode(file_get_contents("http://192.168.1.43:2305/compare", false, stream_context_create([ + 'http' => [ + 'header' => "Content-Type: application/json", + 'method' => "POST", + 'content' => json_encode([ + "type" => "base64", + "img0" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face1'])), + "img1" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face2'])) + ]) + ] + ])), true); + return [ + "type1" => number_format($results['type1']['percent'] * 100, 2), + "type2" => number_format($results['type2']['percent'] * 100, 2) + ]; + } else { + $this->view->title = Yii::t("app", "SO_SANH_MAT"); + return $this->render('face-comparison', [ + ]); + } + } + + public function actionUploadFace() { + if (Yii::$app->request->post()) { + $post = Yii::$app->request->post(); + $model = new \app\models\UploadForm(); + $url = $model->UploadGlobal("image" . $post['imageIndex'], ["PNG", "JPG", "JPEG", "GIF"], "comparison"); + return $url; + } + } + } diff --git a/controllers/ListManagementController.php b/controllers/ListManagementController.php index 40a595b9..fd147771 100644 --- a/controllers/ListManagementController.php +++ b/controllers/ListManagementController.php @@ -927,39 +927,4 @@ class ListManagementController extends Controller { } } - public function actionFaceComparison() { - if (Yii::$app->request->post()) { - $post = Yii::$app->request->post(); - Yii::$app->response->format = "json"; - $results = json_decode(file_get_contents("http://192.168.1.43:2305/compare", false, stream_context_create([ - 'http' => [ - 'header' => "Content-Type: application/json", - 'method' => "POST", - 'content' => json_encode([ - "type" => "base64", - "img0" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face1'])), - "img1" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face2'])) - ]) - ] - ])), true); - return [ - "type1" => number_format($results['type1']['percent'] * 100, 2), - "type2" => number_format($results['type2']['percent'] * 100, 2) - ]; - } else { - $this->view->title = Yii::t("app", "SO_SANH_MAT"); - return $this->render('face-comparison', [ - ]); - } - } - - public function actionUploadFace() { - if (Yii::$app->request->post()) { - $post = Yii::$app->request->post(); - $model = new \app\models\UploadForm(); - $url = $model->UploadGlobal("image" . $post['imageIndex'], ["PNG", "JPG", "JPEG", "GIF"], "comparison"); - return $url; - } - } - } diff --git a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php index 8560f3d5..739149f6 100644 --- a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php +++ b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php @@ -51,15 +51,15 @@ use yii\widgets\ActiveForm; -
  • "> - - - -
  • -
  • "> - - +
  • @@ -94,12 +94,12 @@ use yii\widgets\ActiveForm;