|
@@ -493,6 +493,11 @@ class DeviceManagement(View):
|
|
|
|
|
|
# 根据删除项删除相关数据
|
|
|
if '设备信息数据' in delDataOptions:
|
|
|
+ # 删除用户UID缓存
|
|
|
+ user_list = list(Device_Info.objects.filter(UID__in=uidList).values('userID_id', 'UID'))
|
|
|
+ thread = threading.Thread(target=DeviceManagement.deleteDeviceCache, args=(user_list,))
|
|
|
+ thread.start()
|
|
|
+
|
|
|
Device_Info.objects.filter(UID__in=uidList).delete()
|
|
|
UidPushModel.objects.filter(uid_set__uid__in=uidList).delete()
|
|
|
if '设备配置数据' in delDataOptions:
|
|
@@ -516,9 +521,7 @@ class DeviceManagement(View):
|
|
|
ExperienceContextModel.objects.filter(uid__in=uidList).delete()
|
|
|
# Order_Model.objects.filter(UID__in=uidList, order_type=0).delete()
|
|
|
Device_Info.objects.filter(UID__in=uidList).update(vodPrimaryUserID='', vodPrimaryMaster='')
|
|
|
- # 删除用户UID缓存
|
|
|
- thread = threading.Thread(target=DeviceManagement.deleteDeviceCache, args=(uidList,))
|
|
|
- thread.start()
|
|
|
+
|
|
|
# 上传序列号文件且选中序列号解绑uid
|
|
|
# if serialNumberList is not None and '序列号解绑uid' in delDataOptions:
|
|
|
# # 解绑uid数据
|
|
@@ -561,17 +564,13 @@ class DeviceManagement(View):
|
|
|
def deleteDeviceCache(uid_list):
|
|
|
"""
|
|
|
翻新重置时清楚验证用户UID缓存
|
|
|
- @param uid_list:
|
|
|
- @return:
|
|
|
"""
|
|
|
try:
|
|
|
redis = RedisObject(3)
|
|
|
- for uid in uid_list:
|
|
|
- user_id_list = list(Device_Info.objects.filter(UID=uid).values_list('userID_id', flat=True))
|
|
|
- for user in user_id_list:
|
|
|
- # 构建Redis键
|
|
|
- device_key = f"{RedisKeyConstant.BASIC_USER.value}{user}:UID:{uid}"
|
|
|
- redis.del_data(device_key)
|
|
|
+ for item in uid_list:
|
|
|
+ # 构建Redis键
|
|
|
+ device_key = f"{RedisKeyConstant.BASIC_USER.value}{item['userID_id']}:UID:{item['UID']}"
|
|
|
+ redis.del_data(device_key)
|
|
|
except Exception as e:
|
|
|
error_line = e.__traceback__.tb_lineno
|
|
|
LOGGER.error(f'翻新重置异步清缓存异常:error_line:{error_line}, error_msg:{repr(e)}')
|