update script đồng bộ dữ liệu tới máy chủ
This commit is contained in:
parent
5d5de05f85
commit
237f658e16
|
@ -12,6 +12,7 @@ use yii\console\Controller;
|
||||||
use yii\console\ExitCode;
|
use yii\console\ExitCode;
|
||||||
use app\models\CaptureLogs;
|
use app\models\CaptureLogs;
|
||||||
use app\models\ListManagement;
|
use app\models\ListManagement;
|
||||||
|
use Yii;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This command echoes the first argument that you have entered.
|
* This command echoes the first argument that you have entered.
|
||||||
|
@ -38,8 +39,7 @@ class SyncController extends Controller {
|
||||||
$id_camera = 209;
|
$id_camera = 209;
|
||||||
if ($device_id)
|
if ($device_id)
|
||||||
$id_camera = intval($device_id->data);
|
$id_camera = intval($device_id->data);
|
||||||
|
$ls = CaptureLogs::find()->andWhere(['<>', 'staff_id', 0])->andWhere(['sync_status' => null])->all();
|
||||||
$ls = CaptureLogs::find()->andWhere(['<>', 'staff_id', 0])->andWhere(['sync_status' => 0])->all();
|
|
||||||
foreach ($ls as $key => $value) {
|
foreach ($ls as $key => $value) {
|
||||||
$staffInfo = ListManagement::findOne($value->staff_id);
|
$staffInfo = ListManagement::findOne($value->staff_id);
|
||||||
$res = json_decode(file_get_contents("https://" . $ip . "/api/box/oem_face_recognition", false, stream_context_create([
|
$res = json_decode(file_get_contents("https://" . $ip . "/api/box/oem_face_recognition", false, stream_context_create([
|
||||||
|
@ -47,10 +47,12 @@ class SyncController extends Controller {
|
||||||
'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(Yii::getAlias('@webroot') . "/data/uploads/face/" . $value->image)),
|
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)),
|
||||||
'camera_id' => strval($id_camera),
|
'camera_id' => strval($id_camera),
|
||||||
'frametime' => date("Y-m-d H:i:s", $value->time),
|
'frametime' => date("Y-m-d H:i:s", $value->time + 60 * 60 * 7),
|
||||||
'idCard' => $staffInfo ? strval($staffInfo->code) : "0"
|
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
||||||
|
"person_id" => "123",
|
||||||
|
"timezone" => "+7"
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
])), true);
|
])), true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user