chenjunkai 6 năm trước cách đây
mục cha
commit
8808f7fc39
3 tập tin đã thay đổi với 17 bổ sung6 xóa
  1. 9 6
      Controller/EquipmentInfo.py
  2. 6 0
      Controller/OTAEquipment.py
  3. 2 0
      Controller/UserController.py

+ 9 - 6
Controller/EquipmentInfo.py

@@ -151,12 +151,15 @@ class EquipmentInfo(View):
         if param_flag is True:
             count = 0
             for id in id_list:
-                eq = Equipment_Info.objects.filter(id=id)
-                if eq.exists():
-                    own_dev = ModelService.check_own_device(userID, eq[0].devUid)
-                    if own_dev is True:
-                        count += 1
-                        eq.update(status=1)
+                try:
+                    eq = Equipment_Info.objects.filter(id=int(id))
+                    if eq.exists():
+                        own_dev = ModelService.check_own_device(userID, eq[0].devUid)
+                        if own_dev is True:
+                            count += 1
+                            eq.update(status=1)
+                except Exception as e:
+                    print(repr(e))
             return response.json(0,{'update_success': count})
         else:
             return response.json(444)

+ 6 - 0
Controller/OTAEquipment.py

@@ -524,6 +524,12 @@ def getNewVerInterface(request):
                     file_path = equipment.filePath
                     # path = file_path.replace('static/Upgrade/', '').replace('\\', '/')
                     # url = SERVER_DOMAIN + '/OTA/downloads/' + path + '?time=' + str(time.time())
+                    # 检测ip进行替换
+                    serverip = '54.215.154.29'
+                    client_ip = CommonService.get_ip_address(request)
+                    if serverip == client_ip:
+                        SERVER_DOMAIN = 'http://54.215.154.29'
+                    # get_ip_address =
                     url = SERVER_DOMAIN + '/OTA/downloadsPack/' + file_path + '?time=' + str(time.time())
                     return response.json(0, {
                         'ver': ver,

+ 2 - 0
Controller/UserController.py

@@ -562,8 +562,10 @@ class EmailResetPwdView(TemplateView):
                     else:
                         return response.json(9)
                 else:
+                    return HttpResponseRedirect('http://www.dvema.com/web/html/paw_update_unsuccessful.html?lang=en')
                     return response.json(306, 'rpwd')
             else:
+                return HttpResponseRedirect('http://www.dvema.com/web/html/paw_update_unsuccessful.html?lang=en')
                 return response.json(tko.code)
         else:
             return response.json(444, 'token')