check exitst images
This commit is contained in:
parent
04d467a73c
commit
4d6f1cbed8
|
@ -159,6 +159,7 @@ class ApiController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionResetData() {
|
public function actionResetData() {
|
||||||
|
return file_get_contents("https://bischool.beetai.com/view/image/5f7c1b22dfe5aaf427a6dfa1");
|
||||||
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
||||||
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,8 @@ class ListManagementController extends Controller {
|
||||||
return [
|
return [
|
||||||
"title" => "<i class='fa fa-download'></i> Đồng bộ từ máy chủ",
|
"title" => "<i class='fa fa-download'></i> Đồng bộ từ máy chủ",
|
||||||
"form" => $this->renderPartial("list-server", [
|
"form" => $this->renderPartial("list-server", [
|
||||||
"datas" => $datas['data']
|
"datas" => $datas['data'],
|
||||||
|
"allID" => ListManagement::getAllID()
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -343,13 +344,16 @@ class ListManagementController extends Controller {
|
||||||
foreach ($data['images'] as $key => $value) {
|
foreach ($data['images'] as $key => $value) {
|
||||||
$key = common::generateRandomString();
|
$key = common::generateRandomString();
|
||||||
$fileName = "face_" . $key . "_" . time() . ".png";
|
$fileName = "face_" . $key . "_" . time() . ".png";
|
||||||
file_put_contents($targetPath . "/" . $fileName, file_get_contents($value));
|
$img = file_get_contents($value);
|
||||||
$features = json_decode(common::requestToEngine("/get-feature", [
|
if ($img !== "null") {
|
||||||
"image_paths" => [
|
file_put_contents($targetPath . "/" . $fileName, $img);
|
||||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
$features = json_decode(common::requestToEngine("/get-feature", [
|
||||||
]
|
"image_paths" => [
|
||||||
]), true);
|
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||||
$ft[] = ["url" => $fileName, "features" => $features['results'][0]['feature']];
|
]
|
||||||
|
]), true);
|
||||||
|
$ft[] = ["url" => $fileName, "features" => $features['results'][0]['feature']];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$model = ListManagement::findOne(['code' => $data['idStaff']]);
|
$model = ListManagement::findOne(['code' => $data['idStaff']]);
|
||||||
if ($model) {
|
if ($model) {
|
||||||
|
|
|
@ -98,4 +98,13 @@ class ListManagement extends \yii\db\ActiveRecord {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getAllID() {
|
||||||
|
$res = [];
|
||||||
|
$ls = self::find()->all();
|
||||||
|
foreach ($ls as $key => $value) {
|
||||||
|
$res[] = $value->code;
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,13 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="sync-lists">
|
<tbody id="sync-lists">
|
||||||
{foreach from=$datas item=arr}
|
{foreach from=$datas item=arr}
|
||||||
<tr onclick="choooseToSync(this);" style="cursor: pointer;" data-stt="false" data-id="{$arr.idStaff}">
|
<tr onclick="choooseToSync(this);" style="cursor: pointer;" class="{if !in_array($arr.idStaff,$allID)}not-in-list{/if}" data-stt="false" data-id="{$arr.idStaff}">
|
||||||
<td>{$arr.idStaff}</td>
|
<td>
|
||||||
|
{$arr.idStaff}
|
||||||
|
{if in_array($arr.idStaff,$allID)}
|
||||||
|
<i class="fa fa-check-circle text-green"></i>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
<td>{$arr.name}</td>
|
<td>{$arr.name}</td>
|
||||||
<td>{$arr.department}</td>
|
<td>{$arr.department}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -35,7 +40,7 @@
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<i class="fa fa-info-circle"></i> Đã lựa chọn <b class="text-red" id="totals-choose">0</b> đối tượng.
|
<i class="fa fa-info-circle"></i> Đã lựa chọn <b class="text-red" id="totals-choose">0</b> đối tượng.
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-5">
|
||||||
<div class="hidden" id="progress-form">
|
<div class="hidden" id="progress-form">
|
||||||
Đồng bộ <b id="progress-current" class="text-green">0</b>/<b id="progress-totals" class="text-red">0</b> đối tượng.
|
Đồng bộ <b id="progress-current" class="text-green">0</b>/<b id="progress-totals" class="text-red">0</b> đối tượng.
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
|
@ -45,7 +50,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 text-right">
|
<div class="col-md-5 text-right">
|
||||||
|
<button class="btn btn-default" onclick="checkAllNotInList();">
|
||||||
|
Chọn đối tượng chưa tồn tại
|
||||||
|
</button>
|
||||||
<button class="btn btn-default" onclick="checkAllSync(true);">
|
<button class="btn btn-default" onclick="checkAllSync(true);">
|
||||||
Chọn tất cả
|
Chọn tất cả
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -332,6 +332,12 @@ function checkAllSync(stt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkAllNotInList() {
|
||||||
|
$("#sync-lists").find("tr").removeClass("success").attr("data-stt", "false");
|
||||||
|
$(".not-in-list").addClass("success").attr("data-stt", "true");
|
||||||
|
$("#totals-choose").html($(".not-in-list").length);
|
||||||
|
}
|
||||||
|
|
||||||
var progress = 0;
|
var progress = 0;
|
||||||
var totals = 0;
|
var totals = 0;
|
||||||
function _sync() {
|
function _sync() {
|
||||||
|
@ -348,7 +354,7 @@ function _sync() {
|
||||||
$("#progress-form").removeClass("hidden");
|
$("#progress-form").removeClass("hidden");
|
||||||
totals = lists.length;
|
totals = lists.length;
|
||||||
for (var i = 0; i < lists.length; i++) {
|
for (var i = 0; i < lists.length; i++) {
|
||||||
syncFeatureFromDevice(lists[i]);
|
syncFeatureFromDevice(lists[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user