loc change bug

This commit is contained in:
曹前明 2022-09-15 10:12:16 +08:00
parent 2711bcb8f5
commit 255e23f1cd
2 changed files with 3 additions and 3 deletions

View File

@ -447,7 +447,7 @@ def rail_out(data):
def loc_change(data):
blts = TDevice.objects.filter(code=data['userId']).first()
if blts.employee:
if blts and blts.employee:
# 从缓存查询人员位置信息
key_str = 'ep_{}'.format(blts.employee.id)
ep_loc_dict = cache.get_or_set(
@ -485,7 +485,7 @@ def handle_xx_event(name: str, data: dict):
# 有绑定对象再提示事件(包括一键报警事件/低电量)
blts = TDevice.objects.filter(code=data['mac']).first()
ep_loc_dict = {}
if blts.employee:
if blts and blts.employee:
# 触发事件
cate = EventCate.objects.filter(code=name).first()
# 找到最近未处理同一人发生的事件

View File

@ -44,7 +44,7 @@ class TDevice(BaseModel):
null=True, blank=True)
is_clock = models.BooleanField('是否打卡设备', default=False)
access_list = models.JSONField('自动下发人员类型', default=list,
null=False, blank=True, help_text='employee/remployee/visitor')
null=False, blank=True, help_text='employee/remployee/visitor/driver')
third_info = models.JSONField('三方信息', default=dict,
null=False, blank=True)