fix bug đồng bộ dữ liệu nhân viên
This commit is contained in:
@@ -418,6 +418,8 @@ class DeviceController extends Controller {
|
||||
$UserInfos = [];
|
||||
$UserAuthorizeInfos = [];
|
||||
|
||||
$doorOfDevice = Door::find()->andWhere(['device_id' => $device_id])->all();
|
||||
|
||||
foreach ($staff_lists as $key => $value) {
|
||||
$UserInfos[] = [
|
||||
"CardNo" => $value["card_number"],
|
||||
@@ -428,13 +430,14 @@ class DeviceController extends Controller {
|
||||
"EndTime" => ""
|
||||
];
|
||||
$doors = json_decode($value["door_access"], true);
|
||||
foreach ($doors as $k => $v) {
|
||||
$doorInfo = Door::findOne($v);
|
||||
$UserAuthorizeInfos[] = [
|
||||
"Pin" => $value["id"],
|
||||
"AuthorizeTimezoneId" => $value["schedule_id"],
|
||||
"AuthorizeDoorId" => $doorInfo->code
|
||||
];
|
||||
foreach ($doorOfDevice as $k => $v) {
|
||||
if (in_array($v->id, $doors)) {
|
||||
$UserAuthorizeInfos[] = [
|
||||
"Pin" => $value["id"],
|
||||
"AuthorizeTimezoneId" => $value["schedule_id"],
|
||||
"AuthorizeDoorId" => $v->code
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
$resUser = json_decode(common::requestToCardService("/SetDeviceData/User", [
|
||||
|
||||
Reference in New Issue
Block a user