check exitst images

This commit is contained in:
2020-12-16 13:39:07 +07:00
parent 04d467a73c
commit 4d6f1cbed8
5 changed files with 41 additions and 13 deletions

View File

@@ -159,6 +159,7 @@ class ApiController extends Controller {
}
public function actionResetData() {
return file_get_contents("https://bischool.beetai.com/view/image/5f7c1b22dfe5aaf427a6dfa1");
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
}

View File

@@ -308,7 +308,8 @@ class ListManagementController extends Controller {
return [
"title" => "<i class='fa fa-download'></i> Đồng bộ từ máy chủ",
"form" => $this->renderPartial("list-server", [
"datas" => $datas['data']
"datas" => $datas['data'],
"allID" => ListManagement::getAllID()
])
];
}
@@ -343,13 +344,16 @@ class ListManagementController extends Controller {
foreach ($data['images'] as $key => $value) {
$key = common::generateRandomString();
$fileName = "face_" . $key . "_" . time() . ".png";
file_put_contents($targetPath . "/" . $fileName, file_get_contents($value));
$features = json_decode(common::requestToEngine("/get-feature", [
"image_paths" => [
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
]
]), true);
$ft[] = ["url" => $fileName, "features" => $features['results'][0]['feature']];
$img = file_get_contents($value);
if ($img !== "null") {
file_put_contents($targetPath . "/" . $fileName, $img);
$features = json_decode(common::requestToEngine("/get-feature", [
"image_paths" => [
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
]
]), true);
$ft[] = ["url" => $fileName, "features" => $features['results'][0]['feature']];
}
}
$model = ListManagement::findOne(['code' => $data['idStaff']]);
if ($model) {