This commit is contained in:
dongpd 2021-01-13 18:11:51 +07:00
parent aa811a40dd
commit 5472f6ef77
2 changed files with 27 additions and 11 deletions

View File

@ -236,6 +236,14 @@ class ApiController extends Controller {
public function actionAutoGenFeature() { public function actionAutoGenFeature() {
Yii::$app->response->format = "json"; Yii::$app->response->format = "json";
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']); $updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
if (!$updating) {
$model = new \app\models\SyncUrl();
$model->create([
'key_config' => "updating",
'data' => "false"
]);
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
}
if ($updating->data === "true") { if ($updating->data === "true") {
$txt = "\n" . date("H:i:s d/m/Y") . " " . "updating"; $txt = "\n" . date("H:i:s d/m/Y") . " " . "updating";
file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND); file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);

View File

@ -683,7 +683,11 @@ class ListManagementController extends Controller {
$lsImgs = json_decode($StaffInfo->image, true); $lsImgs = json_decode($StaffInfo->image, true);
$images = []; $images = [];
foreach ($lsImgs as $key => $value) { foreach ($lsImgs as $key => $value) {
$images[] = base64_encode(file_get_contents(Yii::$app->request->hostInfo . "/data/uploads/face/" . $value['url'])); try {
$images[] = base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']));
} catch (\Exception $e) {
}
} }
$items = [ $items = [
"name" => $StaffInfo->name, "name" => $StaffInfo->name,
@ -695,16 +699,20 @@ class ListManagementController extends Controller {
"images" => $images "images" => $images
]; ];
$start = $this->getCurrentTime(); $start = $this->getCurrentTime();
$res = json_decode(file_get_contents($ip . "/api/oem/data_sync_pro", false, stream_context_create([ try {
'http' => [ $res = json_decode(file_get_contents($ip . "/api/oem/data_sync_pro", false, stream_context_create([
'header' => "Content-Type: application/json", 'http' => [
'method' => "POST", 'header' => "Content-Type: application/json",
'content' => json_encode([ 'method' => "POST",
"id_camera" => $id_camera, 'content' => json_encode([
"items" => [$items] "id_camera" => $id_camera,
]) "items" => [$items]
] ])
])), true); ]
])), true);
} catch (\Exception $e) {
}
$finish = $this->getCurrentTime(); $finish = $this->getCurrentTime();
$processTime = round(($finish - $start), 4); $processTime = round(($finish - $start), 4);
return $processTime; //$res; //["status" => true]; return $processTime; //$res; //["status" => true];