ソースを参照

关闭打印日志

tanghongbin 4 年 前
コミット
d057ec1c45
2 ファイル変更1 行追加25 行削除
  1. 1 18
      Controller/DetectController.py
  2. 0 7
      Controller/ShadowController.py

+ 1 - 18
Controller/DetectController.py

@@ -69,13 +69,8 @@ class NotificationView(View):
         else:
             utko = UidTokenObject(uidToken)
             uid = utko.UID
-        # log = 'push----------{time}'.format(time=time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime()))
-        # log += '\n'
-        # log += '\tuid=' + uid
-        # log += '\tchannel=' + channel
-        # log += '\tevent_type=' + event_type
 
-        pkey = '{uid}_{channel}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
+        pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, event_type=event_type, 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)
@@ -94,8 +89,6 @@ class NotificationView(View):
             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)
 
         # 数据库读取数据
@@ -119,8 +112,6 @@ 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的有效时间
@@ -131,8 +122,6 @@ 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))
@@ -275,8 +264,6 @@ 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':
@@ -304,8 +291,6 @@ 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':
@@ -340,8 +325,6 @@ 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)
 
 

+ 0 - 7
Controller/ShadowController.py

@@ -45,8 +45,6 @@ def generate_utk(request):
             # utko.generate(data={'uid': uid})
             etkObj = ETkObject(etk='')
             etk = etkObj.encrypt(uid)
-            LogUtil.write_log(
-                log='generate.end----------{time}'.format(time=time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime())))
             return response.json(0, {'etk': etk})
         else:
             return response.json(404)
@@ -75,11 +73,6 @@ def update_device_shadow(request):
             UidSetModel.objects.filter(uid=uid).delete()
             # 重置设备,判断设备为已删除
             Device_Info.objects.filter(UID=uid).update(isExist=2)
-        log = 'shadow----------{time}'.format(time=time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime()))
-        log += '\n'
-        log += '\tuid=' + uid
-        log += '\tis_reset=' + str(is_reset)
-        LogUtil.write_log(log=log)
 
         return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
         ucode = request_dict.get('ucode', None)