fix bug đồng bộ dữ liệu nhân viên
This commit is contained in:
parent
ad30699a52
commit
018ca540d5
|
@ -97,7 +97,7 @@ class AssignController extends Controller {
|
||||||
Yii::$app->response->format = "json";
|
Yii::$app->response->format = "json";
|
||||||
return [
|
return [
|
||||||
"schedule" => Schedule::findOne($post['schedule'])->name,
|
"schedule" => Schedule::findOne($post['schedule'])->name,
|
||||||
"doors" => implode(", ", $doors)
|
"doors" => implode("<br>", $doors)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,6 +418,8 @@ class DeviceController extends Controller {
|
||||||
$UserInfos = [];
|
$UserInfos = [];
|
||||||
$UserAuthorizeInfos = [];
|
$UserAuthorizeInfos = [];
|
||||||
|
|
||||||
|
$doorOfDevice = Door::find()->andWhere(['device_id' => $device_id])->all();
|
||||||
|
|
||||||
foreach ($staff_lists as $key => $value) {
|
foreach ($staff_lists as $key => $value) {
|
||||||
$UserInfos[] = [
|
$UserInfos[] = [
|
||||||
"CardNo" => $value["card_number"],
|
"CardNo" => $value["card_number"],
|
||||||
|
@ -428,15 +430,16 @@ class DeviceController extends Controller {
|
||||||
"EndTime" => ""
|
"EndTime" => ""
|
||||||
];
|
];
|
||||||
$doors = json_decode($value["door_access"], true);
|
$doors = json_decode($value["door_access"], true);
|
||||||
foreach ($doors as $k => $v) {
|
foreach ($doorOfDevice as $k => $v) {
|
||||||
$doorInfo = Door::findOne($v);
|
if (in_array($v->id, $doors)) {
|
||||||
$UserAuthorizeInfos[] = [
|
$UserAuthorizeInfos[] = [
|
||||||
"Pin" => $value["id"],
|
"Pin" => $value["id"],
|
||||||
"AuthorizeTimezoneId" => $value["schedule_id"],
|
"AuthorizeTimezoneId" => $value["schedule_id"],
|
||||||
"AuthorizeDoorId" => $doorInfo->code
|
"AuthorizeDoorId" => $v->code
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$resUser = json_decode(common::requestToCardService("/SetDeviceData/User", [
|
$resUser = json_decode(common::requestToCardService("/SetDeviceData/User", [
|
||||||
"DeviceIP" => $post["ip"],
|
"DeviceIP" => $post["ip"],
|
||||||
"UserInfos" => $UserInfos
|
"UserInfos" => $UserInfos
|
||||||
|
|
|
@ -97,4 +97,16 @@ class StaffGrid extends CommonGrid {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function scheduleHeader() {
|
||||||
|
return function($model) {
|
||||||
|
return ["id" => "schedule-staff-results-" . $model->id];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function doorsHeader() {
|
||||||
|
return function($model) {
|
||||||
|
return ["id" => "schedule-door-results-" . $model->id];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
'class' => 'table table-striped table-bordered table-hover',
|
'class' => 'table table-striped table-bordered table-hover',
|
||||||
'style' => 'background:#fff;min-width:700px;'
|
'style' => 'background:#fff;min-width:700px;'
|
||||||
],
|
],
|
||||||
'rowOptions' => \app\helpers\CommonGrid::rows("staff", true),
|
|
||||||
'columns' => [
|
'columns' => [
|
||||||
[
|
[
|
||||||
'class' => 'yii\grid\SerialColumn',
|
'class' => 'yii\grid\SerialColumn',
|
||||||
|
@ -37,12 +36,14 @@
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'schedule',
|
'attribute' => 'schedule',
|
||||||
|
'contentOptions' => \app\helpers\StaffGrid::scheduleHeader(),
|
||||||
'value' => \app\helpers\StaffGrid::schedule($scheduleArray)
|
'value' => \app\helpers\StaffGrid::schedule($scheduleArray)
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'doors',
|
'attribute' => 'doors',
|
||||||
'format' => 'raw',
|
'format' => 'raw',
|
||||||
'headerOptions' => ['style' => 'width:15%'],
|
'headerOptions' => ['style' => 'width:15%'],
|
||||||
|
'contentOptions' => \app\helpers\StaffGrid::doorsHeader(),
|
||||||
'value' => \app\helpers\StaffGrid::doors($doorsArray)
|
'value' => \app\helpers\StaffGrid::doors($doorsArray)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user