update đồng bộ tất cả thiết bị
This commit is contained in:
@@ -87,6 +87,9 @@ class DeviceController extends Controller {
|
||||
if ($requestToCardService["Status"] === "ERROR")
|
||||
return ["status" => false, "type" => "connect"];
|
||||
|
||||
if (intval($requestToCardService["LockCount"]) < 1)
|
||||
return ["status" => false, "type" => "connect"];
|
||||
|
||||
$device_id = $model->create([
|
||||
'name' => $data["Name"],
|
||||
'serial' => isset($device['SN']) ? $device['SN'] : "",
|
||||
@@ -378,10 +381,20 @@ class DeviceController extends Controller {
|
||||
public function actionSync() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$post = Yii::$app->request->post("lists");
|
||||
$lists = $post["lists"];
|
||||
if ($post["all"] && count($lists) >= 20) {
|
||||
$temp = [];
|
||||
$devices = Device::find()->all();
|
||||
foreach ($devices as $key => $value) {
|
||||
$temp[] = $value->id;
|
||||
}
|
||||
$lists = $temp;
|
||||
}
|
||||
return [
|
||||
"title" => Html::tag("i", "", ["class" => "fa fa-refresh"]) . " Đồng bộ dữ liệu đến thiết bị",
|
||||
"form" => $this->renderPartial("sync"),
|
||||
"lists" => Yii::$app->request->post("lists")
|
||||
"lists" => $lists
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -533,10 +546,20 @@ class DeviceController extends Controller {
|
||||
public function actionGetLogs() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$post = Yii::$app->request->post("lists");
|
||||
$lists = $post["lists"];
|
||||
if ($post["all"] && count($lists) >= 20) {
|
||||
$temp = [];
|
||||
$devices = Device::find()->all();
|
||||
foreach ($devices as $key => $value) {
|
||||
$temp[] = $value->id;
|
||||
}
|
||||
$lists = $temp;
|
||||
}
|
||||
return [
|
||||
"title" => Html::tag("i", "", ["class" => "fa fa-exchange"]) . " Lấy các sự kiện",
|
||||
"form" => $this->renderPartial("logs"),
|
||||
"lists" => Yii::$app->request->post("lists")
|
||||
"lists" => $lists
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user