update đồng bộ tất cả thiết bị
This commit is contained in:
parent
72dfa46c94
commit
fa10b73a3d
|
@ -48,7 +48,7 @@ $config = [
|
|||
],
|
||||
'assetManager' => [
|
||||
'class' => 'app\\components\\AssetManager',
|
||||
'appendVersion' => '1.0.5',
|
||||
'appendVersion' => '1.0.6',
|
||||
'bundles' => [
|
||||
'dmstr\web\AdminLteAsset' => [
|
||||
'skin' => 'skin-blue',
|
||||
|
|
|
@ -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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,6 +266,10 @@ var currentPage = 1;
|
|||
var secondIncrement = 0;
|
||||
|
||||
async function _sync(e) {
|
||||
var checkAll = $("#checkall-device:checked").length;
|
||||
var all = false;
|
||||
if (checkAll > 0)
|
||||
all = true;
|
||||
var lists = [];
|
||||
$.each($("input[name='checkbox-device']:checked"), function () {
|
||||
lists.push({
|
||||
|
@ -282,7 +286,8 @@ async function _sync(e) {
|
|||
url: $(e).attr('data-href'),
|
||||
type: 'POST',
|
||||
data: {
|
||||
lists: lists
|
||||
lists: lists,
|
||||
all: all
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
|
@ -401,6 +406,10 @@ function getDataSync(data) {
|
|||
var progressLogs = 0;
|
||||
var totalsLogs = 0;
|
||||
function _getLogs(e) {
|
||||
var checkAll = $("#checkall-device:checked").length;
|
||||
var all = false;
|
||||
if (checkAll > 0)
|
||||
all = true;
|
||||
var lists = [];
|
||||
$.each($("input[name='checkbox-device']:checked"), function () {
|
||||
lists.push($(this).val());
|
||||
|
@ -414,7 +423,8 @@ function _getLogs(e) {
|
|||
url: $(e).attr('data-href'),
|
||||
type: 'POST',
|
||||
data: {
|
||||
lists: lists
|
||||
lists: lists,
|
||||
all: all
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
|
|
Loading…
Reference in New Issue
Block a user