|
@@ -80,6 +80,8 @@ class UidSetView(View):
|
|
|
return self.do_admin_update(request_dict, userID, response)
|
|
|
elif operation == 'update':
|
|
|
return self.do_update(request_dict, response)
|
|
|
+ elif operation == 'updateSet':
|
|
|
+ return self.do_update_set(request_dict, response)
|
|
|
else:
|
|
|
return response.json(444, 'error path')
|
|
|
|
|
@@ -312,3 +314,26 @@ class UidSetView(View):
|
|
|
except Exception:
|
|
|
errorInfo = traceback.format_exc()
|
|
|
return response.json(500, {'details': errorInfo})
|
|
|
+
|
|
|
+ def do_update_set(self, request_dict, response):
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
+ deviceContent = request_dict.get('content', None)
|
|
|
+ token = request_dict.get('token', None)
|
|
|
+ print(deviceContent)
|
|
|
+ if not deviceContent or not uid:
|
|
|
+ return response.json(444, 'content,uid')
|
|
|
+ tko = TokenObject(token)
|
|
|
+ response.lang = tko.lang
|
|
|
+ if tko.code != 0:
|
|
|
+ return response.json(tko.code)
|
|
|
+ userID = tko.userID
|
|
|
+ if userID is None:
|
|
|
+ return response.json(309)
|
|
|
+ try:
|
|
|
+ deviceData = json.loads(deviceContent)
|
|
|
+ uid_set_qs = UidSetModel.objects.filter(uid=uid)
|
|
|
+ uid_set_qs.update(**deviceData)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(177, repr(e))
|
|
|
+ else:
|
|
|
+ return response.json(0)
|