chanjunkai 5 vuotta sitten
vanhempi
commit
642580f78e
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      Controller/DetectController.py

+ 4 - 0
Controller/DetectController.py

@@ -68,6 +68,7 @@ class NotificationView(View):
             utko = UidTokenObject(uidToken)
             uid = utko.UID
         pkey = '{uid}_{channel}_ptl'.format(uid=uid, channel=channel)
+        # ykey = 'MUJ887NLR8K8GBM9111A_redis_qs'.format(uid=uid)
         ykey = '{uid}_redis_qs'.format(uid=uid)
         dkey = '{uid}_{channel}_{event_type}_flag'.format(uid=uid, event_type=event_type, channel=channel)
         # 判断redisObj.get_data(key=pkey):不为空
@@ -96,6 +97,9 @@ class NotificationView(View):
                 redis_list.append(qs)
             # 修改redis数据,并设置过期时间为10分钟
             redisObj.set_data(key=ykey, val=str(redis_list), expire=600)
+            if not redis_list:
+                res_data = {'code': 404, 'msg': 'error !'}
+                return JsonResponse(status=200, data=res_data)
 
         if not redis_list:
             print("没有redi_list")