Bug: catch excrption request to engine fail
CR: sonhh (fake)
This commit is contained in:
parent
b207d54462
commit
14467d53b5
|
@ -86,7 +86,7 @@ class ApiController extends Controller {
|
||||||
$ip = $server_ip->data;
|
$ip = $server_ip->data;
|
||||||
if ($this->is_connected() && $logs) {
|
if ($this->is_connected() && $logs) {
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||||
$id_camera = 209;
|
$id_camera = 0;
|
||||||
if ($device_id)
|
if ($device_id)
|
||||||
$id_camera = intval($device_id->data);
|
$id_camera = intval($device_id->data);
|
||||||
$logsInfo = CaptureLogs::findOne($logs);
|
$logsInfo = CaptureLogs::findOne($logs);
|
||||||
|
@ -260,7 +260,7 @@ class ApiController extends Controller {
|
||||||
]);
|
]);
|
||||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||||
}
|
}
|
||||||
$currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true);
|
$currentCache = json_decode(@file_get_contents("http://localhost:2305/current-cache"), true);
|
||||||
if ($updating->data === "true") {
|
if ($updating->data === "true") {
|
||||||
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
||||||
$updating->data = "false";
|
$updating->data = "false";
|
||||||
|
@ -295,12 +295,15 @@ class ApiController extends Controller {
|
||||||
foreach ($images as $k => $v) {
|
foreach ($images as $k => $v) {
|
||||||
if (!isset($v['features512']) || (isset($v['features512']) && count($v['features512']) == 0)) {
|
if (!isset($v['features512']) || (isset($v['features512']) && count($v['features512']) == 0)) {
|
||||||
$start = $this->getCurrentTime();
|
$start = $this->getCurrentTime();
|
||||||
$features = json_decode(common::requestToEngine("/get-feature", [
|
$features = common::requestToEngine("/get-feature", [
|
||||||
"image_paths" => [
|
"image_paths" => [
|
||||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url'], "type" => "raw"]
|
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url'], "type" => "raw"]
|
||||||
],
|
],
|
||||||
"type" => "512"
|
"type" => "512"
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return ["status" => false];
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
$finish = $this->getCurrentTime();
|
$finish = $this->getCurrentTime();
|
||||||
$temp[] = round(($finish - $start), 4);
|
$temp[] = round(($finish - $start), 4);
|
||||||
$v['features512'] = $features['results'][0]['feature512'];
|
$v['features512'] = $features['results'][0]['feature512'];
|
||||||
|
@ -320,7 +323,7 @@ class ApiController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file_get_contents("http://localhost:2305/update-feature");
|
@file_get_contents("http://localhost:2305/update-feature");
|
||||||
$updating->data = "false";
|
$updating->data = "false";
|
||||||
$updating->save();
|
$updating->save();
|
||||||
return ["status" => true];
|
return ["status" => true];
|
||||||
|
@ -334,7 +337,7 @@ class ApiController extends Controller {
|
||||||
if ($server_ip)
|
if ($server_ip)
|
||||||
$ip = $server_ip->data;
|
$ip = $server_ip->data;
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||||
$id_camera = 209;
|
$id_camera = 0;
|
||||||
if ($device_id)
|
if ($device_id)
|
||||||
$id_camera = intval($device_id->data);
|
$id_camera = intval($device_id->data);
|
||||||
$ls = CaptureLogs::find()->andWhere(['sync_status' => null])->all();
|
$ls = CaptureLogs::find()->andWhere(['sync_status' => null])->all();
|
||||||
|
@ -400,7 +403,7 @@ class ApiController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionCurrentCache() {
|
public function actionCurrentCache() {
|
||||||
return file_get_contents("http://localhost:2305/current-cache");
|
return @file_get_contents("http://localhost:2305/current-cache");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionSaveToken() {
|
public function actionSaveToken() {
|
||||||
|
@ -504,13 +507,15 @@ class ApiController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionCheckLogs() {
|
public function actionCheckLogs() {
|
||||||
|
Yii::$app->response->format = "json";
|
||||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||||
$ip = "https://dev-dc.beetai.com";
|
$ip = "https://dev-dc.beetai.com";
|
||||||
if ($server_ip)
|
if ($server_ip)
|
||||||
$ip = $server_ip->data;
|
$ip = $server_ip->data;
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||||
$id_camera = 209;
|
if (!$device_id)
|
||||||
if ($device_id)
|
return ["data" => "check logs fail"];
|
||||||
|
|
||||||
$id_camera = intval($device_id->data);
|
$id_camera = intval($device_id->data);
|
||||||
|
|
||||||
$datas = json_decode(file_get_contents($ip . "/api/model/get_log_model", false, stream_context_create([
|
$datas = json_decode(file_get_contents($ip . "/api/model/get_log_model", false, stream_context_create([
|
||||||
|
@ -562,9 +567,8 @@ class ApiController extends Controller {
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
]));
|
]));
|
||||||
file_get_contents("http://localhost:2305/update-feature?total=" . ListManagement::find()->count());
|
@file_get_contents("http://localhost:2305/update-feature?total=" . ListManagement::find()->count());
|
||||||
}
|
}
|
||||||
Yii::$app->response->format = "json";
|
|
||||||
return ["data" => "check logs"];
|
return ["data" => "check logs"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,12 +601,15 @@ class ApiController extends Controller {
|
||||||
if (!$this->resizeImg($img, $fileTarget)) {
|
if (!$this->resizeImg($img, $fileTarget)) {
|
||||||
file_put_contents($fileTarget, $img);
|
file_put_contents($fileTarget, $img);
|
||||||
}
|
}
|
||||||
$features = json_decode(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"
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return false;
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
$ft[] = [
|
$ft[] = [
|
||||||
"serverKey" => $files_name,
|
"serverKey" => $files_name,
|
||||||
"url" => $fileName,
|
"url" => $fileName,
|
||||||
|
|
|
@ -297,6 +297,38 @@ class ConfigController extends Controller {
|
||||||
|
|
||||||
public function actionReset() {
|
public function actionReset() {
|
||||||
if (Yii::$app->request->post()) {
|
if (Yii::$app->request->post()) {
|
||||||
|
if (Yii::$app->request->post("deleteDB") === "true") {
|
||||||
|
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
||||||
|
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
||||||
|
array_map('unlink', glob("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/*.*"));
|
||||||
|
try {
|
||||||
|
file_get_contents("http://localhost:2305/update-feature");
|
||||||
|
} catch (\Exception $exc) {
|
||||||
|
|
||||||
|
}
|
||||||
|
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||||
|
$ip = "https://dev-dc.beetai.com";
|
||||||
|
if ($server_ip)
|
||||||
|
$ip = $server_ip->data;
|
||||||
|
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||||
|
$id_camera = 0;
|
||||||
|
if ($device_id)
|
||||||
|
$id_camera = intval($device_id->data);
|
||||||
|
try {
|
||||||
|
file_get_contents($ip . "/api/model/reset_log_model", false, stream_context_create([
|
||||||
|
'http' => [
|
||||||
|
'header' => "Content-Type: application/json",
|
||||||
|
'method' => "POST",
|
||||||
|
'content' => json_encode([
|
||||||
|
"idCamera" => $id_camera,
|
||||||
|
"isCloud" => 0
|
||||||
|
])
|
||||||
|
]
|
||||||
|
]));
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Yii::$app->request->post("resetDevice") === "true") {
|
if (Yii::$app->request->post("resetDevice") === "true") {
|
||||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||||
'http' => [
|
'http' => [
|
||||||
|
@ -328,39 +360,8 @@ class ConfigController extends Controller {
|
||||||
]
|
]
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
if (Yii::$app->request->post("deleteDB") === "true") {
|
\app\models\SyncUrl::deleteAll(['IN', 'key_config', ['server_api', 'device_id']]);
|
||||||
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
return Url::to(['/config/cau-hinh-thiet-bi']);
|
||||||
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
|
||||||
array_map('unlink', glob("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/*.*"));
|
|
||||||
try {
|
|
||||||
file_get_contents("http://localhost:2305/update-feature");
|
|
||||||
} catch (\Exception $exc) {
|
|
||||||
|
|
||||||
}
|
|
||||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
|
||||||
$ip = "https://dev-dc.beetai.com";
|
|
||||||
if ($server_ip)
|
|
||||||
$ip = $server_ip->data;
|
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
|
||||||
$id_camera = 209;
|
|
||||||
if ($device_id)
|
|
||||||
$id_camera = intval($device_id->data);
|
|
||||||
try {
|
|
||||||
file_get_contents($ip . "/api/model/reset_log_model", false, stream_context_create([
|
|
||||||
'http' => [
|
|
||||||
'header' => "Content-Type: application/json",
|
|
||||||
'method' => "POST",
|
|
||||||
'content' => json_encode([
|
|
||||||
"idCamera" => $id_camera,
|
|
||||||
"isCloud" => 0
|
|
||||||
])
|
|
||||||
]
|
|
||||||
]));
|
|
||||||
} catch (Exception $ex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Url::to(['/config']);
|
|
||||||
} else {
|
} else {
|
||||||
Yii::$app->response->format = "json";
|
Yii::$app->response->format = "json";
|
||||||
return [
|
return [
|
||||||
|
@ -434,7 +435,7 @@ class ConfigController extends Controller {
|
||||||
$model = new \app\models\SyncUrl();
|
$model = new \app\models\SyncUrl();
|
||||||
$model->create([
|
$model->create([
|
||||||
'key_config' => 'device_id',
|
'key_config' => 'device_id',
|
||||||
'data' => $engineConfig['data']['engines'][0]['id']
|
'data' => strval($engineConfig['data']['engines'][0]['id'])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return $this->render('device', [
|
return $this->render('device', [
|
||||||
|
|
|
@ -100,11 +100,14 @@ class ControlLogsController extends Controller {
|
||||||
if (!$this->resizeImg($img, $fileTarget))
|
if (!$this->resizeImg($img, $fileTarget))
|
||||||
$fileName = $url;
|
$fileName = $url;
|
||||||
|
|
||||||
$features = json_decode(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"]
|
||||||
]
|
]
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
$images[] = [
|
$images[] = [
|
||||||
"url" => $fileName,
|
"url" => $fileName,
|
||||||
"urlOld" => $url,
|
"urlOld" => $url,
|
||||||
|
|
|
@ -97,11 +97,14 @@ class ListManagementController extends Controller {
|
||||||
$check = ListManagement::findOne(['code' => $data['code']]);
|
$check = ListManagement::findOne(['code' => $data['code']]);
|
||||||
if ($check)
|
if ($check)
|
||||||
return ["status" => false];
|
return ["status" => false];
|
||||||
$features = json_decode(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"]
|
||||||
]
|
]
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return ["status" => false];
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
$data['image'] = json_encode([
|
$data['image'] = json_encode([
|
||||||
[
|
[
|
||||||
"url" => $data['image'],
|
"url" => $data['image'],
|
||||||
|
@ -141,11 +144,14 @@ class ListManagementController extends Controller {
|
||||||
if (!$this->resizeImg($img, $fileTarget))
|
if (!$this->resizeImg($img, $fileTarget))
|
||||||
$fileName = $url;
|
$fileName = $url;
|
||||||
|
|
||||||
$features = json_decode(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"]
|
||||||
]
|
]
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
$images[] = [
|
$images[] = [
|
||||||
"url" => $fileName,
|
"url" => $fileName,
|
||||||
"urlOld" => $url,
|
"urlOld" => $url,
|
||||||
|
@ -181,11 +187,14 @@ class ListManagementController extends Controller {
|
||||||
if (!$this->resizeImg($img, $fileTarget))
|
if (!$this->resizeImg($img, $fileTarget))
|
||||||
$fileName = $url;
|
$fileName = $url;
|
||||||
|
|
||||||
$features = json_decode(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"]
|
||||||
]
|
]
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
$data['image'] = json_encode([
|
$data['image'] = json_encode([
|
||||||
[
|
[
|
||||||
"url" => $fileName,
|
"url" => $fileName,
|
||||||
|
@ -239,11 +248,14 @@ class ListManagementController extends Controller {
|
||||||
if (!$this->resizeImg($img, $fileTarget))
|
if (!$this->resizeImg($img, $fileTarget))
|
||||||
$fileName = $data['image'];
|
$fileName = $data['image'];
|
||||||
|
|
||||||
$features = json_decode(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"]
|
||||||
]
|
]
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
$images = json_decode($model->image, true);
|
$images = json_decode($model->image, true);
|
||||||
$images[] = [
|
$images[] = [
|
||||||
"url" => $fileName,
|
"url" => $fileName,
|
||||||
|
@ -357,11 +369,14 @@ class ListManagementController extends Controller {
|
||||||
$model = new common();
|
$model = new common();
|
||||||
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 = json_decode(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"]
|
||||||
]
|
]
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return ["status" => false];
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
unlink("/var/www/html/BiFace_Server_Lite/web/" . $url);
|
unlink("/var/www/html/BiFace_Server_Lite/web/" . $url);
|
||||||
if ($features['results'][0]['crop'] === "") {
|
if ($features['results'][0]['crop'] === "") {
|
||||||
return ["status" => false];
|
return ["status" => false];
|
||||||
|
@ -411,7 +426,7 @@ class ListManagementController extends Controller {
|
||||||
if ($server_ip)
|
if ($server_ip)
|
||||||
$ip = $server_ip->data;
|
$ip = $server_ip->data;
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||||
$id_camera = 209;
|
$id_camera = 0;
|
||||||
if ($device_id)
|
if ($device_id)
|
||||||
$id_camera = intval($device_id->data);
|
$id_camera = intval($device_id->data);
|
||||||
|
|
||||||
|
@ -483,12 +498,15 @@ class ListManagementController extends Controller {
|
||||||
$finish = $this->getCurrentTime();
|
$finish = $this->getCurrentTime();
|
||||||
$temp["saveIMG"] = round(($finish - $start), 4);
|
$temp["saveIMG"] = round(($finish - $start), 4);
|
||||||
$start = $this->getCurrentTime();
|
$start = $this->getCurrentTime();
|
||||||
$features = json_decode(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"
|
||||||
]), true);
|
]);
|
||||||
|
if (!$features['status'])
|
||||||
|
return false;
|
||||||
|
$features = json_decode($features['data'], true);
|
||||||
$finish = $this->getCurrentTime();
|
$finish = $this->getCurrentTime();
|
||||||
$temp["extract"] = round(($finish - $start), 4);
|
$temp["extract"] = round(($finish - $start), 4);
|
||||||
$ft[] = [
|
$ft[] = [
|
||||||
|
@ -525,6 +543,8 @@ class ListManagementController extends Controller {
|
||||||
if ($model) {
|
if ($model) {
|
||||||
if (isset($data['images'])) {
|
if (isset($data['images'])) {
|
||||||
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id'], json_decode($model->image, true));
|
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id'], json_decode($model->image, true));
|
||||||
|
if (!$extractFeature)
|
||||||
|
return false;
|
||||||
$processTime["extractFeature"] = $extractFeature['time'];
|
$processTime["extractFeature"] = $extractFeature['time'];
|
||||||
$ft = $extractFeature['features'];
|
$ft = $extractFeature['features'];
|
||||||
}
|
}
|
||||||
|
@ -545,6 +565,8 @@ class ListManagementController extends Controller {
|
||||||
} else {
|
} else {
|
||||||
if (isset($data['images'])) {
|
if (isset($data['images'])) {
|
||||||
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id']);
|
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id']);
|
||||||
|
if (!$extractFeature)
|
||||||
|
return false;
|
||||||
$processTime["extractFeature"] = $extractFeature['time'];
|
$processTime["extractFeature"] = $extractFeature['time'];
|
||||||
$ft = $extractFeature['features'];
|
$ft = $extractFeature['features'];
|
||||||
}
|
}
|
||||||
|
@ -704,7 +726,7 @@ class ListManagementController extends Controller {
|
||||||
if ($server_ip)
|
if ($server_ip)
|
||||||
$ip = $server_ip->data;
|
$ip = $server_ip->data;
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||||
$id_camera = 209;
|
$id_camera = 0;
|
||||||
if ($device_id)
|
if ($device_id)
|
||||||
$id_camera = intval($device_id->data);
|
$id_camera = intval($device_id->data);
|
||||||
|
|
||||||
|
|
|
@ -130,5 +130,6 @@ return [
|
||||||
"DOI_MAT_KHAU_THANH_CONG" => "Change password successfully",
|
"DOI_MAT_KHAU_THANH_CONG" => "Change password successfully",
|
||||||
"DANG_XU_LY" => "Loading ...",
|
"DANG_XU_LY" => "Loading ...",
|
||||||
"THONG_BAO" => "Notify",
|
"THONG_BAO" => "Notify",
|
||||||
"CO_LOI_XAY_RA_HAY_THU_LAI" => "An error occurred, check the network connection and try again"
|
"CO_LOI_XAY_RA_HAY_THU_LAI" => "An error occurred, check the network connection and try again",
|
||||||
|
"ENGINE_KHONG_HOAT_DONG" => "Engine is not running"
|
||||||
];
|
];
|
||||||
|
|
|
@ -130,5 +130,6 @@ return [
|
||||||
"DOI_MAT_KHAU_THANH_CONG" => "パスワードを正常に変更する",
|
"DOI_MAT_KHAU_THANH_CONG" => "パスワードを正常に変更する",
|
||||||
"DANG_XU_LY" => "処理中 ...",
|
"DANG_XU_LY" => "処理中 ...",
|
||||||
"THONG_BAO" => "報告",
|
"THONG_BAO" => "報告",
|
||||||
"CO_LOI_XAY_RA_HAY_THU_LAI" => "おそらくネットワーク接続が原因でエラーが発生しました。再試行してください"
|
"CO_LOI_XAY_RA_HAY_THU_LAI" => "おそらくネットワーク接続が原因でエラーが発生しました。再試行してください",
|
||||||
|
"ENGINE_KHONG_HOAT_DONG" => "Engine不活動"
|
||||||
];
|
];
|
||||||
|
|
|
@ -130,5 +130,6 @@ return [
|
||||||
"DOI_MAT_KHAU_THANH_CONG" => "Đổi mật khẩu thành công",
|
"DOI_MAT_KHAU_THANH_CONG" => "Đổi mật khẩu thành công",
|
||||||
"DANG_XU_LY" => "Đang xử lý ...",
|
"DANG_XU_LY" => "Đang xử lý ...",
|
||||||
"THONG_BAO" => "Thông báo",
|
"THONG_BAO" => "Thông báo",
|
||||||
"CO_LOI_XAY_RA_HAY_THU_LAI" => "Có lỗi xảy ra, có thể do đường truyền mạng, xin vui lòng thử lại"
|
"CO_LOI_XAY_RA_HAY_THU_LAI" => "Có lỗi xảy ra, có thể do đường truyền mạng, xin vui lòng thử lại",
|
||||||
|
"ENGINE_KHONG_HOAT_DONG" => "Engine không hoạt động"
|
||||||
];
|
];
|
||||||
|
|
|
@ -172,17 +172,20 @@ class common extends \yii\db\ActiveRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function requestToEngine($path, $data) {
|
public static function requestToEngine($path, $data) {
|
||||||
return file_get_contents("http://localhost:2305" . $path, false, stream_context_create([
|
$content = @file_get_contents("http://localhost:2305" . $path, false, stream_context_create([
|
||||||
'http' => [
|
'http' => [
|
||||||
'header' => "Content-Type: application/json",
|
'header' => "Content-Type: application/json",
|
||||||
'method' => "POST",
|
'method' => "POST",
|
||||||
'content' => json_encode($data)
|
'content' => json_encode($data)
|
||||||
]
|
]
|
||||||
]));
|
]));
|
||||||
|
if ($content == false)
|
||||||
|
return ["status" => false];
|
||||||
|
return ["status" => true, "data" => $content];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function updateFeature($datas) {
|
public static function updateFeature($datas) {
|
||||||
return file_get_contents("http://localhost:2305/update-person", false, stream_context_create([
|
return @file_get_contents("http://localhost:2305/update-person", false, stream_context_create([
|
||||||
'http' => [
|
'http' => [
|
||||||
'header' => "Content-Type: application/json",
|
'header' => "Content-Type: application/json",
|
||||||
'method' => "POST",
|
'method' => "POST",
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
<input type="hidden" name="DONG_BO_DU_LIEU_HOAN_THANH" value="{Yii::t("app", "DONG_BO_DU_LIEU_HOAN_THANH")}">
|
<input type="hidden" name="DONG_BO_DU_LIEU_HOAN_THANH" value="{Yii::t("app", "DONG_BO_DU_LIEU_HOAN_THANH")}">
|
||||||
<input type="hidden" name="DA_THEM_HINH_ANH_MAU" value="{Yii::t("app", "DA_THEM_HINH_ANH_MAU")}">
|
<input type="hidden" name="DA_THEM_HINH_ANH_MAU" value="{Yii::t("app", "DA_THEM_HINH_ANH_MAU")}">
|
||||||
<input type="hidden" name="CO_LOI_XAY_RA_HAY_THU_LAI" value="{Yii::t("app", "CO_LOI_XAY_RA_HAY_THU_LAI")}">
|
<input type="hidden" name="CO_LOI_XAY_RA_HAY_THU_LAI" value="{Yii::t("app", "CO_LOI_XAY_RA_HAY_THU_LAI")}">
|
||||||
|
<input type="hidden" name="ENGINE_KHONG_HOAT_DONG" value="{Yii::t("app", "ENGINE_KHONG_HOAT_DONG")}">
|
||||||
|
|
||||||
<div id="blocking" class="fade modal" role="dialog" tabindex="-1">
|
<div id="blocking" class="fade modal" role="dialog" tabindex="-1">
|
||||||
<div class="modal-dialog" style="top: 50%;margin-top: -45px;">
|
<div class="modal-dialog" style="top: 50%;margin-top: -45px;">
|
||||||
|
|
|
@ -465,6 +465,11 @@ function syncFeature(id, fullData) {
|
||||||
totals: totals
|
totals: totals
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
if (!data) {
|
||||||
|
common.modalBlock(false);
|
||||||
|
common.modalAlert($("input[name='ENGINE_KHONG_HOAT_DONG']").val(), "danger", "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log(data, progress);
|
console.log(data, progress);
|
||||||
progress++;
|
progress++;
|
||||||
$("#progress-current").html(parseInt($("#progress-current").html()) + 1);
|
$("#progress-current").html(parseInt($("#progress-current").html()) + 1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user