change menu
This commit is contained in:
parent
982db2b6c8
commit
d6d7dc3719
|
@ -109,7 +109,8 @@ class ApiController extends Controller {
|
||||||
'method' => "POST",
|
'method' => "POST",
|
||||||
'content' => json_encode([
|
'content' => json_encode([
|
||||||
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName)),
|
'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);
|
])), true);
|
||||||
|
@ -149,7 +150,7 @@ class ApiController extends Controller {
|
||||||
}
|
}
|
||||||
$allFeatures[] = [
|
$allFeatures[] = [
|
||||||
"id" => $value->id,
|
"id" => $value->id,
|
||||||
"object_id" => $value->staff_id,
|
"object_id" => $value->staff_id,
|
||||||
"name" => $this->convert_vi_to_en($value->name),
|
"name" => $this->convert_vi_to_en($value->name),
|
||||||
"feature1" => $feature1,
|
"feature1" => $feature1,
|
||||||
"feature2" => $feature2
|
"feature2" => $feature2
|
||||||
|
@ -353,6 +354,7 @@ class ApiController extends Controller {
|
||||||
foreach ($ls as $key => $value) {
|
foreach ($ls as $key => $value) {
|
||||||
if (file_exists("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)) {
|
if (file_exists("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)) {
|
||||||
$staffInfo = ListManagement::findOne($value->staff_id);
|
$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([
|
$res = json_decode(file_get_contents($ip . "/api/oem/face_recognition?token=" . $tk, false, stream_context_create([
|
||||||
'http' => [
|
'http' => [
|
||||||
'header' => "Content-Type: application/json",
|
'header' => "Content-Type: application/json",
|
||||||
|
@ -364,7 +366,8 @@ class ApiController extends Controller {
|
||||||
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
||||||
'idObject' => $staffInfo ? $staffInfo->staff_id : "",
|
'idObject' => $staffInfo ? $staffInfo->staff_id : "",
|
||||||
"person_id" => "123",
|
"person_id" => "123",
|
||||||
"timezone" => "+7"
|
"timezone" => "+7",
|
||||||
|
'confidence' => isset($confidence['percent1']) ? floatval($confidence['percent1']) : 0
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
])), true);
|
])), true);
|
||||||
|
|
|
@ -117,4 +117,39 @@ class CaptureLogsController extends Controller {
|
||||||
throw new NotFoundHttpException(Yii::t("app", "KHONG_TIM_THAY_THONG_TIN"));
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,15 +51,15 @@ use yii\widgets\ActiveForm;
|
||||||
<i class="fa fa-list"></i> <?php echo Yii::t("app", "QUAN_LY_MAU"); ?>
|
<i class="fa fa-list"></i> <?php echo Yii::t("app", "QUAN_LY_MAU"); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="<?php if (Yii::$app->controller->id == "capture-logs") echo "active"; ?>">
|
<li class="dropdown <?php if (in_array(Yii::$app->controller->id, ['capture-logs', 'control-logs'])) echo "active"; ?>">
|
||||||
<a href="<?php echo yii\helpers\Url::to(['/capture-logs']); ?>">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||||
<i class="fa fa-camera"></i> <?php echo Yii::t("app", "LICH_SU_HE_THONG"); ?>
|
<i class="fa fa-list-alt"></i> <?php echo Yii::t("app", "LICH_SU_HE_THONG"); ?>
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="<?php if (Yii::$app->controller->id == "control-logs") echo "active"; ?>">
|
|
||||||
<a href="<?php echo yii\helpers\Url::to(['/control-logs']); ?>">
|
|
||||||
<i class="fa fa-database"></i> <?php echo Yii::t("app", "DANH_SACH_NHAN_DIEN"); ?>
|
|
||||||
</a>
|
</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="<?php echo \yii\helpers\Url::to(['/capture-logs']); ?>"><i class="fa fa-camera"></i> <?php echo Yii::t("app", "LICH_SU_HE_THONG"); ?></a></li>
|
||||||
|
<li><a href="<?php echo \yii\helpers\Url::to(['/control-logs']); ?>"><i class="fa fa-database"></i> <?php echo Yii::t("app", "DANH_SACH_NHAN_DIEN"); ?></a></li>
|
||||||
|
<li><a href="<?php echo \yii\helpers\Url::to(['/capture-logs/face-comparison']); ?>"><i class="fa fa-users"></i> <?php echo Yii::t("app", "SO_SANH_MAT"); ?></a></li>
|
||||||
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -94,12 +94,12 @@ use yii\widgets\ActiveForm;
|
||||||
<li class="dropdown user user-menu">
|
<li class="dropdown user user-menu">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||||
<img src="<?php
|
<img src="<?php
|
||||||
if (Yii::$app->user->isGuest) {
|
if (Yii::$app->user->isGuest) {
|
||||||
echo $directoryAsset . "/img/user2-160x160.jpg";
|
echo $directoryAsset . "/img/user2-160x160.jpg";
|
||||||
} else {
|
} else {
|
||||||
echo Yii::$app->user->identity->user_image == null ? $directoryAsset . "/img/user2-160x160.jpg" : Yii::getAlias("@images_folder") . Yii::$app->user->identity->user_image;
|
echo Yii::$app->user->identity->user_image == null ? $directoryAsset . "/img/user2-160x160.jpg" : Yii::getAlias("@images_folder") . Yii::$app->user->identity->user_image;
|
||||||
}
|
}
|
||||||
?>" class="user-image user-avatar" alt="User Image"/>
|
?>" class="user-image user-avatar" alt="User Image"/>
|
||||||
<span class="hidden-xs user-profiles-name">
|
<span class="hidden-xs user-profiles-name">
|
||||||
<?php
|
<?php
|
||||||
if (Yii::$app->user->isGuest) {
|
if (Yii::$app->user->isGuest) {
|
||||||
|
@ -116,12 +116,12 @@ use yii\widgets\ActiveForm;
|
||||||
<div class="user-panel">
|
<div class="user-panel">
|
||||||
<div class="pull-left image">
|
<div class="pull-left image">
|
||||||
<img src="<?php
|
<img src="<?php
|
||||||
if (Yii::$app->user->isGuest) {
|
if (Yii::$app->user->isGuest) {
|
||||||
echo $directoryAsset . "/img/user2-160x160.jpg";
|
echo $directoryAsset . "/img/user2-160x160.jpg";
|
||||||
} else {
|
} else {
|
||||||
echo Yii::$app->user->identity->user_image == null ? $directoryAsset . "/img/user2-160x160.jpg" : Yii::getAlias("@images_folder") . Yii::$app->user->identity->user_image;
|
echo Yii::$app->user->identity->user_image == null ? $directoryAsset . "/img/user2-160x160.jpg" : Yii::getAlias("@images_folder") . Yii::$app->user->identity->user_image;
|
||||||
}
|
}
|
||||||
?>" class="img-circle user-avatar">
|
?>" class="img-circle user-avatar">
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-left info">
|
<div class="pull-left info">
|
||||||
<p style="color: #fff;" class="user-profiles-name"><?= Yii::$app->user->isGuest ? "" : \Yii::$app->user->identity->first_name; ?></p>
|
<p style="color: #fff;" class="user-profiles-name"><?= Yii::$app->user->isGuest ? "" : \Yii::$app->user->identity->first_name; ?></p>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
{use class="app\assets\FaceComparisonAsset"}
|
{use class="app\assets\FaceComparisonAsset"}
|
||||||
{FaceComparisonAsset::register($this)|void}
|
{FaceComparisonAsset::register($this)|void}
|
||||||
{block name='content'}<br>
|
{block name='content'}<br>
|
||||||
<input type="hidden" name="url_upload_face" value="{Url::to(['/list-management/upload-face'])}">
|
<input type="hidden" name="url_upload_face" value="{Url::to(['/capture-logs/upload-face'])}">
|
||||||
<input type="hidden" name="url_face_comparison" value="{Url::to(['/list-management/face-comparison'])}">
|
<input type="hidden" name="url_face_comparison" value="{Url::to(['/capture-logs/face-comparison'])}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3 col-md-push-2 text-center">
|
<div class="col-md-3 col-md-push-2 text-center">
|
||||||
<img src="/images/user2-160x160.jpg" class="img-thumbnail" id="face1" style="width: 70%;cursor: pointer;" onclick="$('#image1').trigger('click');">
|
<img src="/images/user2-160x160.jpg" class="img-thumbnail" id="face1" style="width: 70%;cursor: pointer;" onclick="$('#image1').trigger('click');">
|
|
@ -124,9 +124,6 @@
|
||||||
])}
|
])}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2" style="padding-right: 30px;">
|
<div class="col-md-2" style="padding-right: 30px;">
|
||||||
<div class="pull-right" style="margin-top: 10px;">
|
|
||||||
<a class="btn btn-primary btn-xs" href="{Url::to(['/list-management/face-comparison'])}">{Yii::t("app", "SO_SANH_MAT")}</a>
|
|
||||||
</div>
|
|
||||||
<h4>{Yii::t("app", "TIM_KIEM_DU_LIEU")}</h4>
|
<h4>{Yii::t("app", "TIM_KIEM_DU_LIEU")}</h4>
|
||||||
{*<div class="form-group">
|
{*<div class="form-group">
|
||||||
<label class="control-label">Từ</label>
|
<label class="control-label">Từ</label>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user