pengzhibo168 %!s(int64=5) %!d(string=hai) anos
pai
achega
87546c6f35
Modificáronse 1 ficheiros con 7 adicións e 4 borrados
  1. 7 4
      Controller/DetectController.py

+ 7 - 4
Controller/DetectController.py

@@ -76,9 +76,7 @@ class NotificationView(View):
         have_ykey = redisObj.get_data(key=ykey)  # uid_set 数据库缓存
         have_pkey = redisObj.get_data(key=pkey)  # 一分钟限制key
         have_dkey = redisObj.get_data(key=dkey)  # 推送类型限制
-        # 打印have_ykey
-        return JsonResponse(status=200,
-                            data={'pkey': 0, 'have_ykey': have_ykey, 'have_pkey': have_pkey, 'have_dkey': have_dkey})
+
         # 一分钟外,推送开启状态
         detect_med_type = 0  # 0推送旧机制 1存库不推送,2推送存库
         if have_pkey:
@@ -107,8 +105,9 @@ class NotificationView(View):
 
         if not redis_list:
             print("没有redi_list")
-            res_data = {'code': 0, 'msg': 'success!'}
+            res_data = {'code': 0, 'msg': 'no redi_list success!'}
             return JsonResponse(status=200, data=res_data)
+
         is_sys_msg = self.is_sys_msg(int(event_type))
         nickname = redis_list[0]['uid_set__nickname']
         detect_interval = redis_list[0]['uid_set__detect_interval']
@@ -132,6 +131,10 @@ class NotificationView(View):
                         redisObj.set_data(key=dkey, val=1, expire=detect_interval)
                 redisObj.set_data(key=pkey, val=1, expire=60)
 
+        # 打印have_ykey
+        return JsonResponse(status=200, data={'pkey': 0, 'have_ykey': have_ykey, 'have_pkey': have_pkey,
+                                                  'have_ykey': have_dkey})
+
     # 旧模式并且没有pkey,重新创建一个
         if not detect_group and not have_pkey:
             # 设置推送时间为60秒一次