From ecd1b64de63f4dd0636366f78330e37fdfdfe671 Mon Sep 17 00:00:00 2001 From: xuecong <> Date: Fri, 19 Nov 2021 11:45:44 +0800 Subject: [PATCH] optimite entrance access of vistor --- server/src/iot/entrance/access.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/src/iot/entrance/access.ts b/server/src/iot/entrance/access.ts index 4863c00..305f859 100644 --- a/server/src/iot/entrance/access.ts +++ b/server/src/iot/entrance/access.ts @@ -95,6 +95,16 @@ async function accessMethod(params: AccessParams, entranceInfo: EjyyIotEntrance, return { AcsRes: CLOSE }; } + if (reuslt.type === VISTOR_ACCESS_CODE) { + const vistorInfo = await model.from('ejyy_vistor') + .where('id', reuslt.id) + .first(); + + if (!vistorInfo || vistorInfo.expire > Date.now()) { + return { AcsRes: CLOSE }; + } + } + let method: typeof IOT_METHOD_NFC | typeof IOT_METHOD_ICCARD | typeof IOT_METHOD_QRCODE = IOT_METHOD_QRCODE; if (params.type === TYPE_CARD) {