Compare commits

..

2 Commits

Author SHA1 Message Date
dongpd
aa28d09d93 fix bug + thêm mẫu người mới trên thiết bị 2025-09-25 21:13:56 +07:00
9960469007 Update controllers/ApiController.php 2024-11-22 02:03:33 +00:00
6 changed files with 80 additions and 46 deletions

View File

@ -518,6 +518,7 @@ class ApiController extends Controller {
} }
public function actionReGenFeature() { public function actionReGenFeature() {
@file_get_contents("http://localhost:2305/update-feature");
\app\models\SyncUrl::deleteAll(['key_config' => 'log_process_status']); \app\models\SyncUrl::deleteAll(['key_config' => 'log_process_status']);
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']); $updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
if (!$updating) { if (!$updating) {

View File

@ -14,9 +14,21 @@ class ConfigController extends Controller {
public function init() { public function init() {
parent::init(); parent::init();
}
public function beforeAction($action) {
if (!parent::beforeAction($action)) {
return false;
}
Yii::$app->language = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : Yii::$app->language; Yii::$app->language = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : Yii::$app->language;
if (Yii::$app->user->isGuest)
return $this->redirect(['/site/login']); if (Yii::$app->user->isGuest) {
$this->redirect(['/site/login']);
return false;
}
return true;
} }
/** /**
@ -759,5 +771,4 @@ class ConfigController extends Controller {
return true; return true;
} }
} }
} }

View File

@ -102,15 +102,15 @@ class ListManagementController extends Controller {
if ($check) if ($check)
return ["status" => false]; return ["status" => false];
$features = common::requestToEngine("/get-feature", [ $features = common::requestToEngine("/get-feature", [
"image_paths" => [ "image_paths" => [
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $data['image'], "type" => "raw"] ["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $data['image'], "type" => "raw"]
] ]
]); ]);
if (!$features['status']) if (!$features['status'])
return ["status" => false]; return ["status" => false];
$features = json_decode($features['data'], true); $features = json_decode($features['data'], true);
$data['image'] = json_encode([ $data['image'] = json_encode([
[ [
"url" => $data['image'], "url" => $data['image'],
"features" => $features['results'][0]['feature'], "features" => $features['results'][0]['feature'],
"features512" => isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : [] "features512" => isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
@ -149,9 +149,9 @@ class ListManagementController extends Controller {
$fileName = $url; $fileName = $url;
$features = common::requestToEngine("/get-feature", [ $features = common::requestToEngine("/get-feature", [
"image_paths" => [ "image_paths" => [
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"] ["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
] ]
]); ]);
if (!$features['status']) if (!$features['status'])
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")]; return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
@ -193,15 +193,15 @@ class ListManagementController extends Controller {
$fileName = $url; $fileName = $url;
$features = common::requestToEngine("/get-feature", [ $features = common::requestToEngine("/get-feature", [
"image_paths" => [ "image_paths" => [
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"] ["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
] ]
]); ]);
if (!$features['status']) if (!$features['status'])
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")]; return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
$features = json_decode($features['data'], true); $features = json_decode($features['data'], true);
$data['image'] = json_encode([ $data['image'] = json_encode([
[ [
"url" => $fileName, "url" => $fileName,
"urlOld" => $url, "urlOld" => $url,
"features" => $features['results'][0]['feature'], "features" => $features['results'][0]['feature'],
@ -254,9 +254,9 @@ class ListManagementController extends Controller {
$fileName = $data['image']; $fileName = $data['image'];
$features = common::requestToEngine("/get-feature", [ $features = common::requestToEngine("/get-feature", [
"image_paths" => [ "image_paths" => [
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"] ["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
] ]
]); ]);
if (!$features['status']) if (!$features['status'])
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")]; return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
@ -379,9 +379,9 @@ class ListManagementController extends Controller {
Yii::$app->response->format = "json"; Yii::$app->response->format = "json";
$url = $model->UploadFile("AnhNhanVien", ["PNG", "JPG", "JPEG", "GIF"], "temp"); $url = $model->UploadFile("AnhNhanVien", ["PNG", "JPG", "JPEG", "GIF"], "temp");
$features = common::requestToEngine("/get-feature", [ $features = common::requestToEngine("/get-feature", [
"image_paths" => [ "image_paths" => [
["url" => "/var/www/html/BiFace_Server_Lite/web/" . $url, "type" => "crop"] ["url" => "/var/www/html/BiFace_Server_Lite/web/" . $url, "type" => "crop"]
] ]
]); ]);
if (!$features['status']) if (!$features['status'])
return ["status" => false]; return ["status" => false];
@ -510,10 +510,10 @@ class ListManagementController extends Controller {
$temp["saveIMG"] = round(($finish - $start), 4); $temp["saveIMG"] = round(($finish - $start), 4);
$start = $this->getCurrentTime(); $start = $this->getCurrentTime();
$features = common::requestToEngine("/get-feature", [ $features = common::requestToEngine("/get-feature", [
"image_paths" => [ "image_paths" => [
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"] ["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
], ],
"type" => "128" "type" => "128"
]); ]);
if (!$features['status']) if (!$features['status'])
return false; return false;
@ -705,12 +705,12 @@ class ListManagementController extends Controller {
$staff = ListManagement::findOne(['id' => $post['code']]); $staff = ListManagement::findOne(['id' => $post['code']]);
Yii::$app->response->format = "json"; Yii::$app->response->format = "json";
return [ return [
"name" => $staff->name, "name" => $staff ? $staff->name : "",
"gender" => $staff->gender, "gender" => $staff ? $staff->gender : "",
"birthday" => date("d/m/Y", $staff->birthday), "birthday" => $staff ? date("d/m/Y", $staff->birthday) : "",
"telephone" => $staff->telephone, "telephone" => $staff ? $staff->telephone : "",
"department" => $staff->address, "department" => $staff ? $staff->address : "",
"abbreviated_name" => $staff->abbreviated_name "abbreviated_name" => $staff ? $staff->abbreviated_name : ""
]; ];
} }
} }
@ -849,12 +849,12 @@ class ListManagementController extends Controller {
if ($post['editAll'] == "true" && isset($post['lists'])) { if ($post['editAll'] == "true" && isset($post['lists'])) {
foreach ($post['lists'] as $key => $value) { foreach ($post['lists'] as $key => $value) {
$schedule = \app\models\Schedule::findOne([ $schedule = \app\models\Schedule::findOne([
'from_time' => $model->from_time, 'from_time' => $model->from_time,
'to_time' => $model->to_time, 'to_time' => $model->to_time,
'from_date' => $model->from_date, 'from_date' => $model->from_date,
'to_date' => $model->to_date, 'to_date' => $model->to_date,
'date_of_week' => $model->date_of_week, 'date_of_week' => $model->date_of_week,
'staff_id' => $value 'staff_id' => $value
]); ]);
if ($schedule) { if ($schedule) {
$schedule->from_time = $post['fromTime']; $schedule->from_time = $post['fromTime'];
@ -903,12 +903,12 @@ class ListManagementController extends Controller {
if ($post['editAll'] == "true" && isset($post['lists'])) { if ($post['editAll'] == "true" && isset($post['lists'])) {
foreach ($post['lists'] as $key => $value) { foreach ($post['lists'] as $key => $value) {
$schedule = \app\models\Schedule::findOne([ $schedule = \app\models\Schedule::findOne([
'from_time' => $model->from_time, 'from_time' => $model->from_time,
'to_time' => $model->to_time, 'to_time' => $model->to_time,
'from_date' => $model->from_date, 'from_date' => $model->from_date,
'to_date' => $model->to_date, 'to_date' => $model->to_date,
'date_of_week' => $model->date_of_week, 'date_of_week' => $model->date_of_week,
'staff_id' => $value 'staff_id' => $value
]); ]);
if ($schedule) if ($schedule)
$schedule->delete(); $schedule->delete();
@ -926,5 +926,4 @@ class ListManagementController extends Controller {
]; ];
} }
} }
} }

View File

@ -1,7 +1,7 @@
copy.src.files=false copy.src.files=false
copy.src.on.open=false copy.src.on.open=false
copy.src.target= copy.src.target=
remote.connection=BiFace-99bab6 remote.connection=tungbt-c365ac
remote.directory=/BiFace_Server_Lite remote.directory=/BiFace_Server_Lite
remote.upload=ON_SAVE remote.upload=ON_SAVE
run.as=REMOTE run.as=REMOTE

View File

@ -49,7 +49,7 @@
'format' => "raw", 'format' => "raw",
'contentOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'],
'value' => \app\helpers\CaptureLogsGrid::image() 'value' => \app\helpers\CaptureLogsGrid::image(true)
], ],
[ [
'attribute' => 'confidence', 'attribute' => 'confidence',

View File

@ -1,7 +1,24 @@
$(function () { $(function () {
common.dateTimePickerByClass("datepicker", "HH:mm DD/MM/YYYY"); common.dateTimePickerByClass("datepicker", "HH:mm DD/MM/YYYY");
common.dateTimePickerDay("birthday"); common.dateTimePickerDay("birthday");
$("#Code").select2(); $("#Code").select2({
tags: true,
createTag: function (params) {
return {
id: params.term,
text: params.term,
newOption: true
};
},
templateResult: function (data) {
var $result = $("<span></span>");
$result.text(data.text);
if (data.newOption) {
$result.append(" <em>(Thêm mới)</em>");
}
return $result;
}
});
$("input[name='AllData']").change(function () { $("input[name='AllData']").change(function () {
if ($('input[name=AllData]').is(':checked')) { if ($('input[name=AllData]').is(':checked')) {
window.location = $("input[name='URL']").val() + "?all=true" + "&from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val(); window.location = $("input[name='URL']").val() + "?all=true" + "&from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val();
@ -26,6 +43,12 @@ function _form(e) {
var confidence = JSON.parse($(e).attr("data-confidence")); var confidence = JSON.parse($(e).attr("data-confidence"));
$("#closest-img").attr("src", confidence.img != "" ? confidence.img : "/images/user2-160x160.jpg"); $("#closest-img").attr("src", confidence.img != "" ? confidence.img : "/images/user2-160x160.jpg");
$("#closest-name").html(confidence.name + " [" + confidence.score + "]"); $("#closest-name").html(confidence.name + " [" + confidence.score + "]");
clearData();
}
function clearData() {
$('#Code').val("").trigger('change');
} }
function _close() { function _close() {