|
@@ -184,6 +184,7 @@ class EquipmentManagerV3(View):
|
|
|
if tko.code == 0:
|
|
|
redisObj = RedisObject(db=8)
|
|
|
redis_value = redisObj.get_data(key='uid_qs_'+userID)
|
|
|
+ result = []
|
|
|
if redis_value == False:
|
|
|
# print('缓存不存在就开始添加到缓存')
|
|
|
userID = tko.userID
|
|
@@ -301,14 +302,15 @@ class EquipmentManagerV3(View):
|
|
|
data.append(p)
|
|
|
# 缓存时间为一个钟
|
|
|
redisObj.set_data(key='uid_qs_'+userID, val=data, expire=3600)
|
|
|
+ result = data
|
|
|
print('分页')
|
|
|
- items=[]
|
|
|
- for index, item in enumerate(data):
|
|
|
- if (page - 1) * line <= index:
|
|
|
- if index < page * line:
|
|
|
- item['View_Password']=self.encrypt_pwd(item['View_Password'])
|
|
|
- items.append(item)
|
|
|
- return response.json(0, items)
|
|
|
+ # items=[]
|
|
|
+ # for index, item in enumerate(data):
|
|
|
+ # if (page - 1) * line <= index:
|
|
|
+ # if index < page * line:
|
|
|
+ # item['View_Password']=self.encrypt_pwd(item['View_Password'])
|
|
|
+ # items.append(item)
|
|
|
+ # return response.json(0, items)
|
|
|
else:
|
|
|
# print('去缓存找数据')
|
|
|
redis_value = redis_value.replace("'", '"')
|
|
@@ -322,31 +324,33 @@ class EquipmentManagerV3(View):
|
|
|
except Exception as e:
|
|
|
print(repr(e))
|
|
|
return response.json(0, {'data': redis_value})
|
|
|
- if NickName:
|
|
|
- # print('NickName搜索缓存')
|
|
|
- for index, item in enumerate(redis_value):
|
|
|
- if NickName ==item['NickName']:
|
|
|
- # 加密
|
|
|
- item['View_Password'] = self.encrypt_pwd(item['View_Password'])
|
|
|
- return response.json(0, item)
|
|
|
- if uid:
|
|
|
- # print('uid搜索缓存')
|
|
|
- for index, item in enumerate(redis_value):
|
|
|
- if uid == item['UID']:
|
|
|
- # 加密
|
|
|
- item['View_Password'] = self.encrypt_pwd(item['View_Password'])
|
|
|
- return response.json(0, item)
|
|
|
- items = []
|
|
|
- # print('缓存分页')
|
|
|
- for index, item in enumerate(redis_value):
|
|
|
- if (page - 1) * line <= index:
|
|
|
- if index < page * line:
|
|
|
- # 加密
|
|
|
- item['View_Password'] = self.encrypt_pwd(item['View_Password'])
|
|
|
- print(item)
|
|
|
- items.append(item)
|
|
|
- print(items)
|
|
|
- return response.json(0, items)
|
|
|
+ result = redis_value
|
|
|
+
|
|
|
+ if NickName:
|
|
|
+ # print('NickName搜索缓存')
|
|
|
+ for index, item in enumerate(result):
|
|
|
+ if NickName == item['NickName']:
|
|
|
+ # 加密
|
|
|
+ item['View_Password'] = self.encrypt_pwd(item['View_Password'])
|
|
|
+ return response.json(0, item)
|
|
|
+ if uid:
|
|
|
+ # print('uid搜索缓存')
|
|
|
+ for index, item in enumerate(result):
|
|
|
+ if uid == item['UID']:
|
|
|
+ # 加密
|
|
|
+ item['View_Password'] = self.encrypt_pwd(item['View_Password'])
|
|
|
+ return response.json(0, item)
|
|
|
+ items = []
|
|
|
+ # print('缓存分页')
|
|
|
+ for index, item in enumerate(result):
|
|
|
+ if (page - 1) * line <= index:
|
|
|
+ if index < page * line:
|
|
|
+ # 加密
|
|
|
+ item['View_Password'] = self.encrypt_pwd(item['View_Password'])
|
|
|
+ print(item)
|
|
|
+ items.append(item)
|
|
|
+ print(items)
|
|
|
+ return response.json(0, items)
|
|
|
else:
|
|
|
return response.json(tko.code)
|
|
|
|