fix bug exception get logs
This commit is contained in:
parent
476f01098f
commit
58a5522642
|
@ -107,18 +107,18 @@ class ApiController extends Controller {
|
||||||
$data[] = "123"; //person_id
|
$data[] = "123"; //person_id
|
||||||
$data[] = "+7"; //timezone
|
$data[] = "+7"; //timezone
|
||||||
$text = implode("|", $data);
|
$text = implode("|", $data);
|
||||||
$res = json_decode(file_get_contents($ip . "/api/box/face_recognition_auth_v2?token=" . $tk, false, stream_context_create([
|
$res = json_decode(@file_get_contents($ip . "/api/box/face_recognition_auth_v2?token=" . $tk, false, stream_context_create([
|
||||||
'http' => [
|
'http' => [
|
||||||
'header' => "Content-Type: application/json",
|
'header' => "Content-Type: application/json",
|
||||||
'method' => "POST",
|
'method' => "POST",
|
||||||
'content' => json_encode([
|
'content' => json_encode([
|
||||||
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName)),
|
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName)),
|
||||||
'data' => common::rsaEncode($text),
|
'data' => common::rsaEncode($text),
|
||||||
'confidence' => isset($post["confidence"]["percent1"]) ? $post["confidence"]["percent1"] : 0
|
'confidence' => isset($post["confidence"]["percent1"]) ? $post["confidence"]["percent1"] : 0
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
])), true);
|
])), true);
|
||||||
if ($res['status'] == 10000) {
|
if ($res && $res['status'] == 10000) {
|
||||||
$logsInfo->sync_status = 1;
|
$logsInfo->sync_status = 1;
|
||||||
$logsInfo->save();
|
$logsInfo->save();
|
||||||
}
|
}
|
||||||
|
@ -395,8 +395,10 @@ class ApiController extends Controller {
|
||||||
if ($connected) {
|
if ($connected) {
|
||||||
$is_conn = true; //action when connected
|
$is_conn = true; //action when connected
|
||||||
fclose($connected);
|
fclose($connected);
|
||||||
|
// file_put_contents("log_connect_server.txt", "\n" . date("H:i:s d/m/Y") . " connected " . $host . ":" . $port, FILE_APPEND);
|
||||||
} else {
|
} else {
|
||||||
$is_conn = false; //action in connection failure
|
$is_conn = false; //action in connection failure
|
||||||
|
// file_put_contents("log_connect_server.txt", "\n" . date("H:i:s d/m/Y") . " disconnected " . $host . ":" . $port, FILE_APPEND);
|
||||||
}
|
}
|
||||||
return $is_conn;
|
return $is_conn;
|
||||||
}
|
}
|
||||||
|
@ -491,12 +493,14 @@ class ApiController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionTest() {
|
public function actionTest() {
|
||||||
// $updating = \app\models\SyncUrl::findOne(['key_config' => 'token']);
|
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||||
$updating = \app\models\SyncUrl::find()->all();
|
$ip = "https://dev-dc.beetai.com";
|
||||||
foreach ($updating as $key => $value) {
|
if ($server_ip)
|
||||||
echo $value->key_config . " " . $value->data . "<br>";
|
$ip = $server_ip->data;
|
||||||
}
|
$parseUrl = parse_url($ip);
|
||||||
exit();
|
$host = $parseUrl['host'];
|
||||||
|
$port = isset($parseUrl['port']) ? $parseUrl['port'] : 80;
|
||||||
|
$this->is_connected($host, $port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionReGenFeature() {
|
public function actionReGenFeature() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user