Explorar o código

处理region 报错

chenshibin %!s(int64=4) %!d(string=hai) anos
pai
achega
baa5a464a9
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      Controller/DetectControllerV2.py

+ 5 - 1
Controller/DetectControllerV2.py

@@ -67,7 +67,11 @@ class NotificationView(View):
         region = request_dict.get('region', None)
         if not region:
             return JsonResponse(status=200, data={'code': 404, 'msg': 'region is not exist'})
-        region = int(region)
+        try:
+            region = int(region)
+        except Exception as e:
+            return JsonResponse(status=200, data={'code': 404, 'msg': 'region is not exist'})
+
         # print("aaa")
         # return JsonResponse(0,safe=False)
         if not all([channel, n_time]):