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() {
@file_get_contents("http://localhost:2305/update-feature");
\app\models\SyncUrl::deleteAll(['key_config' => 'log_process_status']);
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
if (!$updating) {

View File

@ -14,9 +14,21 @@ class ConfigController extends Controller {
public function 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;
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;
}
}
}

View File

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

View File

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

View File

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

View File

@ -1,7 +1,24 @@
$(function () {
common.dateTimePickerByClass("datepicker", "HH:mm DD/MM/YYYY");
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 () {
if ($('input[name=AllData]').is(':checked')) {
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"));
$("#closest-img").attr("src", confidence.img != "" ? confidence.img : "/images/user2-160x160.jpg");
$("#closest-name").html(confidence.name + " [" + confidence.score + "]");
clearData();
}
function clearData() {
$('#Code').val("").trigger('change');
}
function _close() {