add logs api synclogs
This commit is contained in:
parent
ea202ccc3f
commit
21cc5f2050
|
@ -122,6 +122,8 @@ class ApiController extends Controller {
|
|||
if ($res && $res['status'] == 10000) {
|
||||
$logsInfo->sync_status = 1;
|
||||
$logsInfo->save();
|
||||
} else {
|
||||
file_put_contents("log_connect_server.txt", "\n[" . date("H:i:s d/m/Y") . "] /api/box/face_recognition_auth_v2 timeout " . $ip, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
|
@ -362,25 +364,31 @@ class ApiController extends Controller {
|
|||
if (file_exists("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)) {
|
||||
$staffInfo = ListManagement::findOne($value->staff_id);
|
||||
$confidence = json_decode($value->confidence, true);
|
||||
$res = json_decode(file_get_contents($ip . "/api/oem/face_recognition?token=" . $tk, false, stream_context_create([
|
||||
$data = [];
|
||||
$data[] = strval($id_camera); //camera_id
|
||||
$data[] = date("Y-m-d H:i:s", $value->time); //frametime
|
||||
$data[] = $staffInfo ? strval($staffInfo->code) : "0"; //idCard
|
||||
$data[] = $staffInfo ? $staffInfo->staff_id : ""; //idObject
|
||||
$data[] = "123"; //person_id
|
||||
$data[] = "+7"; //timezone
|
||||
$text = implode("|", $data);
|
||||
$res = json_decode(@file_get_contents($ip . "/api/box/face_recognition_auth_v2?token=" . $tk, false, stream_context_create([
|
||||
'http' => [
|
||||
'timeout' => Yii::$app->params['timeoutRequestServer'],
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)),
|
||||
'camera_id' => strval($id_camera),
|
||||
'frametime' => date("Y-m-d H:i:s", $value->time),
|
||||
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
||||
'idObject' => $staffInfo ? $staffInfo->staff_id : "",
|
||||
"person_id" => "123",
|
||||
"timezone" => "+7",
|
||||
'data' => common::rsaEncode($text),
|
||||
'confidence' => isset($confidence['percent1']) ? floatval($confidence['percent1']) : 0
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
if ($res['status'] == 10000) {
|
||||
if ($res && $res['status'] == 10000) {
|
||||
$value->sync_status = 1;
|
||||
$value->save();
|
||||
} else {
|
||||
file_put_contents("log_connect_server.txt", "\n[" . date("H:i:s d/m/Y") . "][SYNC] face_recognition_auth_v2 timeout " . $ip, FILE_APPEND);
|
||||
}
|
||||
} else {
|
||||
$value->delete();
|
||||
|
|
Loading…
Reference in New Issue
Block a user