fix bug + thêm mẫu người mới trên thiết bị
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user