2 Commits

Author SHA1 Message Date
7181c32bbf Merge branch 'dev_DTD' into BiFacePro2.0.1
# Conflicts:
#	controllers/ApiController.php
2021-11-29 10:54:55 +07:00
c3d93f64c6 check image exists 2021-11-29 10:42:02 +07:00
2 changed files with 31 additions and 44 deletions

View File

@@ -350,28 +350,29 @@ class ApiController extends Controller {
if ($token) if ($token)
$tk = $token->data; $tk = $token->data;
foreach ($ls as $key => $value) { foreach ($ls as $key => $value) {
$staffInfo = ListManagement::findOne($value->staff_id); if (file_exists("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)) {
$data = []; $staffInfo = ListManagement::findOne($value->staff_id);
$data[] = strval($id_camera); //camera_id $res = json_decode(file_get_contents($ip . "/api/oem/face_recognition?token=" . $tk, false, stream_context_create([
$data[] = date("Y-m-d H:i:s", $value->time); //frametime 'http' => [
$data[] = $staffInfo ? strval($staffInfo->code) : "0"; //idCard 'header' => "Content-Type: application/json",
$data[] = $staffInfo ? $staffInfo->staff_id : ""; //idObject 'method' => "POST",
$data[] = "123"; //person_id 'content' => json_encode([
$data[] = "+7"; //timezone 'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)),
$text = implode("|", $data); 'camera_id' => strval($id_camera),
$res = json_decode(file_get_contents($ip . "/api/box/face_recognition_auth_v2?token=" . $tk, false, stream_context_create([ 'frametime' => date("Y-m-d H:i:s", $value->time),
'http' => [ 'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
'header' => "Content-Type: application/json", 'idObject' => $staffInfo ? $staffInfo->staff_id : "",
'method' => "POST", "person_id" => "123",
'content' => json_encode([ "timezone" => "+7"
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)), ])
'data' => common::rsaEncode($text) ]
]) ])), true);
] if ($res['status'] == 10000) {
])), true); $value->sync_status = 1;
if ($res['status'] == 10000) { $value->save();
$value->sync_status = 1; }
$value->save(); } else {
$value->delete();
} }
} }
} }
@@ -480,26 +481,12 @@ class ApiController extends Controller {
} }
public function actionTest() { public function actionTest() {
// $key = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCXB8c44cboYsGG6IzISqxf8W7q3AN0mGmekDYpBWpz9udif+jwK6h7NuOZvFDeB/32TVrtvaGDmExCeBerpcoOvGh4eUXyke2lSLzrg7pc/wD0KproEGoAAFDB0Pr5bZhg6ELp3Sk++0MPyxH6u1pgtHDxEnMwXV8cxw/rSCM+wIDAQAB'; // $updating = \app\models\SyncUrl::findOne(['key_config' => 'token']);
// $rsa = new \phpseclib3\Crypt\RSA; $updating = \app\models\SyncUrl::find()->all();
// $rsa->loadKey($key); foreach ($updating as $key => $value) {
// $rsa->setPublicKey($key); echo $value->key_config . " " . $value->data . "<br>";
// }
// echo $rsa->getPublicKey(); exit();
// exit();
$test = "10|2021-07-27 19:16:25|211155|1|2021-07-27 19:16:25";
$encode = common::rsaEncode($test);
$res = json_decode(file_get_contents("http://192.168.0.9:6004/api/box/face_recognition_auth_v2", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST",
'content' => json_encode([
'image' => 'abc',
'data' => $encode
])
]
])), true);
return var_dump($res);
} }
public function actionReGenFeature() { public function actionReGenFeature() {

View File

@@ -2,9 +2,9 @@
<i class="fa fa-info-circle"></i> {Yii::t("app", "RESET_THIET_BI_LOI")} <i class="fa fa-info-circle"></i> {Yii::t("app", "RESET_THIET_BI_LOI")}
</div> </div>
<div class="text-left"> <div class="text-left">
<input type="checkbox" name="DeleteDatabase" style="width: inherit;"> {Yii::t("app", "XOA_DU_LIEU_LUU_TRU_TRONG_THIET_BI")} <input type="checkbox" name="DeleteDatabase" checked="" style="width: inherit;"> {Yii::t("app", "XOA_DU_LIEU_LUU_TRU_TRONG_THIET_BI")}
<br> <br>
<input type="checkbox" name="ResetDevice" style="width: inherit;"> {Yii::t("app", "RESET_CAU_HINH_THIET_BI")} <input type="checkbox" name="ResetDevice" checked="" style="width: inherit;"> {Yii::t("app", "RESET_CAU_HINH_THIET_BI")}
</div> </div>
<div class="text-center"> <div class="text-center">
<button class="btn btn-danger" onclick="common.reset(this);" data-href="{yii\helpers\Url::to(['/config/reset'])}" id="reset-accept"> <button class="btn btn-danger" onclick="common.reset(this);" data-href="{yii\helpers\Url::to(['/config/reset'])}" id="reset-accept">