|
@@ -20,6 +20,7 @@ from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
from Service.CommonService import CommonService
|
|
|
from Service.ModelService import ModelService
|
|
|
+from Object.RedisObject import RedisObject
|
|
|
|
|
|
|
|
|
# http://192.168.136.40:8077/account/showUserMore?token=test
|
|
@@ -255,17 +256,17 @@ def showAllUserInterface(request):
|
|
|
device_user_count = device_user_queryset.count()
|
|
|
device_user_res = device_user_queryset.order_by('-data_joined')[(page - 1) * line:page * line]
|
|
|
sqlDict = CommonService.qs_to_dict(device_user_res)
|
|
|
+ redisObj = RedisObject(db=3)
|
|
|
for k, v in enumerate(sqlDict["datas"]):
|
|
|
if len(v['fields']['role']) > 0:
|
|
|
role_query_set = Role.objects.get(rid=v['fields']['role'][0])
|
|
|
sqlDict["datas"][k]['fields']['role'].append(role_query_set.roleName)
|
|
|
for val in device_user_res:
|
|
|
if v['pk'] == val.userID:
|
|
|
- if sqlDict["datas"][k]['fields']['online'] is True:
|
|
|
- dl_time = val.last_login + datetime.timedelta(minutes=5)
|
|
|
- now_time = timezone.localtime(timezone.now())
|
|
|
- if now_time > dl_time:
|
|
|
- sqlDict["datas"][k]['fields']['online'] = False
|
|
|
+ if redisObj.get_data(key=v['pk']):
|
|
|
+ sqlDict["datas"][k]['fields']['online'] = True
|
|
|
+ else:
|
|
|
+ sqlDict["datas"][k]['fields']['online'] = False
|
|
|
sqlDict['count'] = device_user_count
|
|
|
return response.json(0, sqlDict)
|
|
|
else:
|
|
@@ -310,7 +311,7 @@ class setUserValidView(View):
|
|
|
else:
|
|
|
return self.UserValidUpdatePC(superID, eUserID, isValid, rid, response)
|
|
|
else:
|
|
|
- return response.json(444,'superID or userID')
|
|
|
+ return response.json(444, 'superID or userID')
|
|
|
|
|
|
def UserValidUpdatePC(self, superID, eUserID, isValid, rid, response):
|
|
|
super = Device_User.objects.filter(userID=superID)
|