Parcourir la source

打印日志3

tanghongbin il y a 4 ans
Parent
commit
a3230b5297
1 fichiers modifiés avec 14 ajouts et 2 suppressions
  1. 14 2
      Controller/DetectController.py

+ 14 - 2
Controller/DetectController.py

@@ -74,7 +74,7 @@ class NotificationView(View):
         log += '\tuid=' + uid
         log += '\tchannel=' + channel
         log += '\tevent_type=' + event_type
-        LogUtil.write_log(log=log)
+
 
         pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
         # ykey = 'MUJ887NLR8K8GBM9111A_redis_qs'.format(uid=uid)
@@ -94,6 +94,9 @@ class NotificationView(View):
                 res_data = {'code': 0, 'msg': 'Push once every 10 seconds'}
             else:
                 res_data = {'code': 0, 'msg': 'Push it once a minute'}
+
+            log += '\tcode=200'
+            LogUtil.write_log(log=log)
             return JsonResponse(status=200, data=res_data)
 
         # 数据库读取数据
@@ -117,6 +120,8 @@ class NotificationView(View):
             redisObj.set_data(key=ykey, val=str(redis_list), expire=600)
             if not redis_list:
                 res_data = {'code': 404, 'msg': 'error !'}
+                log += '\tcode=200'
+                LogUtil.write_log(log=log)
                 return JsonResponse(status=200, data=res_data)
 
             # 此时应该更新一下redis里面的dkey的有效时间
@@ -127,6 +132,8 @@ class NotificationView(View):
         if not redis_list:
             print("没有redi_list")
             res_data = {'code': 0, 'msg': 'no redi_list success!'}
+            log += '\tcode=200'
+            LogUtil.write_log(log=log)
             return JsonResponse(status=200, data=res_data)
 
         is_sys_msg = self.is_sys_msg(int(event_type))
@@ -269,6 +276,8 @@ class NotificationView(View):
                 del up['uid_set__nickname']
                 del up['uid_set__detect_interval']
                 del up['uid_set__detect_group']
+            log += '\tcode=200'
+            LogUtil.write_log(log=log)
             return JsonResponse(status=200, data={'code': 0, 'msg': 'success 0 or 2' ,'re_list':redis_list})
 
         elif is_st == '1':
@@ -296,7 +305,8 @@ class NotificationView(View):
             else:
                 # 是正式服务器的时候
                 res_data = {'code': 0, 'img_push': url, 'msg': 'success'}
-
+            log += '\tcode=200'
+            LogUtil.write_log(log=log)
             return JsonResponse(status=200, data=res_data)
 
         elif is_st == '3':
@@ -331,6 +341,8 @@ class NotificationView(View):
             else:
                 # 是正式服务器的时候
                 res_data = {'code': 0, 'img_url_list': img_url_list, 'msg': 'success 3'}
+            log += '\tcode=200'
+            LogUtil.write_log(log=log)
             return JsonResponse(status=200, data=res_data)