update config

This commit is contained in:
2020-12-10 17:04:41 +07:00
parent 94215e4e80
commit 483e0fa349
9 changed files with 189 additions and 15 deletions

View File

@@ -270,12 +270,21 @@ class ListManagementController extends Controller {
public function actionSyncFromServer() {
if (Yii::$app->request->isAjax) {
$datas = json_decode(file_get_contents("https://dev-dc.beetai.com/api/oem/get_all_image", false, stream_context_create([
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
$ip = "dev-dc.beetai.com";
if ($server_ip)
$ip = $server_ip->data;
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
$id_camera = 209;
if ($device_id)
$id_camera = intval($device_id->data);
$datas = json_decode(file_get_contents("https://" . $ip . "/api/oem/get_all_image", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST",
'content' => json_encode([
"id_camera" => 209,
"id_camera" => $id_camera,
"ids_staff" => []
])
]
@@ -293,12 +302,20 @@ class ListManagementController extends Controller {
public function actionSyncFeature() {
if (Yii::$app->request->post()) {
Yii::$app->response->format = "json";
$res = json_decode(file_get_contents("https://dev-dc.beetai.com/api/oem/get_all_image", false, stream_context_create([
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
$ip = "dev-dc.beetai.com";
if ($server_ip)
$ip = $server_ip->data;
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
$id_camera = 209;
if ($device_id)
$id_camera = intval($device_id->data);
$res = json_decode(file_get_contents("https://" . $ip . "/api/oem/get_all_image", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST",
'content' => json_encode([
"id_camera" => 209,
"id_camera" => $id_camera,
"ids_staff" => [strval(Yii::$app->request->post("id"))]
])
]