chenjunkai 5 жил өмнө
parent
commit
a6d589cbf3

+ 8 - 9
Controller/EquipmentInfo.py

@@ -149,16 +149,15 @@ class EquipmentInfo(View):
 
 
     def update_info(self, request_dict, userID, response):
-        id_all = request_dict.getlist('all', None)
-        type = request_dict.getlist('eventType', None)
-        if id_all == 1:
+        is_update_all = request_dict.get('is_update_all', 0)
+        eventType = request_dict.get('eventType', None)
+        if int(is_update_all) == 1:
             try:
-                if Type == 57:
-                    eq = Equipment_Info.objects.filter(userID=userID, eventType=type)
-                    eq.update(status=1)
-                else:
-                    eq = Equipment_Info.objects.filter(userID=userID)
-                    eq.update(status=1)
+                eq = Equipment_Info.objects.filter(userID_id=userID)
+                if eventType:
+                    eq = eq.filter(eventType=int(eventType))
+                is_update = eq.update(status=1)
+                return response.json(0, {'update_count': is_update})
             except Exception as e:
                 print(repr(e))
             return response.json(0, {'update_success': 'all'})