瀏覽代碼

记录解绑uid异常日志;中性app选择中国返回国内域名

locky 2 年之前
父節點
當前提交
4eb35a8a6f
共有 2 個文件被更改,包括 27 次插入14 次删除
  1. 12 11
      Controller/RegionController.py
  2. 15 3
      Controller/SerialNumberController.py

+ 12 - 11
Controller/RegionController.py

@@ -338,18 +338,19 @@ class RegionView(View):
                 country_qs = country_qs.annotate(api=F('country__region__api'))
             country_qs = country_qs.values('country_id', 'country_name', 'api', 'push_api').order_by('country_id')
 
-            # app中国返回美洲域名
+            # app选择中国且不为中性,返回美洲域名
             if is_app:
-                for country in country_qs:
-                    if country['country_id'] == 1:
-                        country['push_api'] = 'https://push.dvema.com/'
-                        if 'Zosi' in app_name:
-                            country['api'] = 'https://api.zositech2.com/'
-                        elif 'Loocam' in app_name:
-                            country['api'] = 'https://api.loocam2.com/'
-                        else:
-                            country['api'] = 'https://www.dvema.com/'
-                        break
+                if '新中性' not in app_name:
+                    for country in country_qs:
+                        if country['country_id'] == 1:
+                            country['push_api'] = 'https://push.dvema.com/'
+                            if 'Zosi' in app_name:
+                                country['api'] = 'https://api.zositech2.com/'
+                            elif 'Loocam' in app_name:
+                                country['api'] = 'https://api.loocam2.com/'
+                            else:
+                                country['api'] = 'https://www.dvema.com/'
+                            break
             # AVSS
             else:
                 for country in country_qs:

+ 15 - 3
Controller/SerialNumberController.py

@@ -453,7 +453,8 @@ class SerialNumberView(View):
         else:
             return response.json(444)
 
-    def do_detach_uid(self, request, request_dict, response):
+    @staticmethod
+    def do_detach_uid(request, request_dict, response):
         token = request_dict.get('token', None)
         time_stamp = request_dict.get('time_stamp', None)
         serial_number = request_dict.get('serial_number', None)
@@ -542,8 +543,19 @@ class SerialNumberView(View):
                 LogModel.objects.create(**log)
             return response.json(0)
         except Exception as e:
-            djangoLogger = logging.getLogger('django')
-            djangoLogger.exception(repr(e))
+            # 记录操作日志
+            ip = CommonService.get_ip_address(request)
+            content = json.loads(json.dumps(request_dict))
+            log = {
+                'ip': ip,
+                'user_id': 1,
+                'status': 200,
+                'time': now_time,
+                'content': json.dumps(content) + '异常:{}'.format(repr(e)),
+                'url': 'serialNumber/detachUID',
+                'operation': '序列号{}解绑uid{}异常'.format(serial, uid),
+            }
+            LogModel.objects.create(**log)
             return response.json(176, str(e))
 
     def get_uid(self, request_dict, response, request):