Closed nghoanghiep closed 5 years ago
Hi! Yes, I saw the problem, and did some fixed.
Please note: it is not possible to receive more than 4000 entries for attendance log and more than 2000 entries for user list. I have no idea why, But when the code try to pull big data i.e. more than 4000 Attendance Log records, the machine denies to send data.
Unfortunately I have no solution yet for getting user list having more than 2000 records on machine.
My solution for attedance: receive the attendance log hourly, save to your own DB and remove from device, this will keep the data size on machine small, so that in next request you can get the data successfully.
/**
* Get log from device
*
* @param string $ip
* @return array
*/
private function get($ip)
{
if (!empty($ip)) {
$zk = new ZKLib($ip);
if ($zk->connect()) {
$zk->disableDevice();
$log = $zk->getAttendance();
if (count($log) > 0) {
$zk->clearAttendance();
$zk->enableDevice();
$zk->disconnect();
}
return $log;
}
}
return [];
}
Let's check this out, this can pull my data very well, more than 2000 records no problem https://github.com/kamshory/ZKLibrary
Thanks for sharing, but after comparing the code you given with my code, I do not see any difference. In addition when I tried to run the code given by you to pull data from machine, It refused to send User Records (around 2300 User Records).
Just want to clarify here I am discussing about two types of records User Records and Attendance Records. May be you are talking about attendance records when you said "this can pull my data very well, more than 2000 records no problem".
For Attendance Records my code also pulls more than 2000 but cannot pull more than 4000. For User Records my code can pull around 2000 entries but more that the machine refuse to send data.
Thanks for the clarification! I think I'll push it to database and clear on the attendance machine everytime
Hi, you're doing a great job. When I test this code with my machine it can get device info and people's name correctly, but it can't get the attendance log. I tried var_dump($attendance); after $attendance = $zk->getAttendance(); it returned empty value. I can still download attendance log with other win form program. Please help.
Thank you very much