Closed csulit closed 4 years ago
At this time there is no way to check the client is check-in or check-out , I think you can declare it in you application , which machine used for checkout or check-in and add another field to your data !
Yea, even in the SDK, I can't find that feature, but thank you, by the way.
I thought I saw this working as in the example this way:
zkInstance.getRealTimeLogs((data) => {
// do something when some checkin
console.log(data);
});
just don't disconnect and each time there is a checkin that cb is run with data given eg:
{ userId: '1', attTime: '2019-12-02T06:05:55.000Z' }
So you can assume that the moment they do it first then it's a checkin, then next time it's a checkout. You could also put a rate-limit for once every 10 seconds or so, such that if this happens within that time it's still a checkin/checkout and the cb is not utilized to log it as a checkout/checkin respectively (maybe user used it again thinking it didn't work properly). And if there are expected scheduled times then it even makes more sense. To fool-proof this I'd put 2 devices, one inside and the other outside. Data from the inside always means checkout, and data from the outside always means checkin.
zkInstance.getRealTimeLogs((data) => { // do something when some checkin console.log(data); }); this code is not working?
How to get the data if the client check-in or check-out the premise in getAttences?