update fault_information

This commit is contained in:
dongpd 2022-07-05 10:05:58 +07:00
parent 8758bb3692
commit 64d9ad0b88

View File

@ -514,6 +514,7 @@ class ApiController extends Controller {
}
public function actionCheckLogs() {
set_time_limit(5000);
Yii::$app->response->format = "json";
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
$ip = "https://dev-dc.beetai.com";
@ -537,6 +538,7 @@ class ApiController extends Controller {
if ($datas['status'] == 10000) {
$logs = $datas['data'];
$infomation = [];
$fault_information = [];
foreach ($logs as $key => $value) {
$result = true;
if ($value['action'] == "insert_image")
@ -557,12 +559,19 @@ class ApiController extends Controller {
array_map('unlink', glob("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/*.*"));
}
if ($result && in_array($value['action'], ['insert_image', 'remove_image', 'insert_info', 'remove_info', 'reset_all'])) {
$infomation[] = [
"obj_Log" => $value['obj_Log'],
"action" => $value['action'],
"idCamera" => $id_camera
];
if (in_array($value['action'], ['insert_image', 'remove_image', 'insert_info', 'remove_info', 'reset_all'])) {
if ($result)
$infomation[] = [
"obj_Log" => $value['obj_Log'],
"action" => $value['action'],
"idCamera" => $id_camera
];
else
$fault_information[] = [
"obj_Log" => $value['obj_Log'],
"action" => $value['action'],
"idCamera" => $id_camera
];
}
}
if (count($infomation) > 0)
@ -571,7 +580,8 @@ class ApiController extends Controller {
'header' => "Content-Type: application/json",
'method' => "POST",
'content' => json_encode([
"infomation" => $infomation
"infomation" => $infomation,
"fault_information" => $fault_information
])
]
]));
@ -642,7 +652,7 @@ class ApiController extends Controller {
$images = json_decode($model->image, true);
$ft = [];
foreach ($images as $key => $value) {
if ($value['serverKey'] !== $files_name)
if (isset($value['serverKey']) && $value['serverKey'] !== $files_name)
$ft[] = $value;
else
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']);