check image exists

This commit is contained in:
dongpd 2021-11-29 10:42:02 +07:00
parent a27bf65303
commit c3d93f64c6

View File

@ -347,6 +347,7 @@ class ApiController extends Controller {
if ($token) if ($token)
$tk = $token->data; $tk = $token->data;
foreach ($ls as $key => $value) { foreach ($ls as $key => $value) {
if (file_exists("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)) {
$staffInfo = ListManagement::findOne($value->staff_id); $staffInfo = ListManagement::findOne($value->staff_id);
$res = json_decode(file_get_contents($ip . "/api/oem/face_recognition?token=" . $tk, false, stream_context_create([ $res = json_decode(file_get_contents($ip . "/api/oem/face_recognition?token=" . $tk, false, stream_context_create([
'http' => [ 'http' => [
@ -367,6 +368,9 @@ class ApiController extends Controller {
$value->sync_status = 1; $value->sync_status = 1;
$value->save(); $value->save();
} }
} else {
$value->delete();
}
} }
} }
return ["status" => true]; return ["status" => true];