Commit c53cc695 by xiongyuwen

no message

parent 043f3516
...@@ -40,7 +40,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -40,7 +40,7 @@ namespace Bailun.Discuz.Application.WeiPan
/// <summary> /// <summary>
/// 递归获取所有首页下的所有文件列表数据 /// 递归获取所有首页下的所有文件列表数据
/// </summary> /// </summary>
Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId); Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId,bool isGetRedis = true);
Task<AttachmentsDto> GetAttchmattachmentByFileId(string fileId); Task<AttachmentsDto> GetAttchmattachmentByFileId(string fileId);
......
...@@ -231,12 +231,17 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -231,12 +231,17 @@ namespace Bailun.Discuz.Application.WeiPan
/// <summary> /// <summary>
/// 递归获取所有首页下的所有文件列表数据 /// 递归获取所有首页下的所有文件列表数据
/// </summary> /// </summary>
public async Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId) public async Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId, bool isGetRedis = true)
{ {
List<FileListTreeDto> fileListTreeDtos = new List<FileListTreeDto>(); List<FileListTreeDto> fileListTreeDtos = new List<FileListTreeDto>();
List<FileListTreeDto> cachingResponse = null;
//判断缓存中是否有值,如果有值直接读取 //判断缓存中是否有值,如果有值直接读取
var redisKey = Constants.File_List_Tree; var redisKey = Constants.File_List_Tree;
var cachingResponse = RedisHelper.HGet<List<FileListTreeDto>>(redisKey, userId+"_"+ fildId); if (isGetRedis)
{
cachingResponse = RedisHelper.HGet<List<FileListTreeDto>>(redisKey, userId + "_" + fildId);
}
if (cachingResponse != null) if (cachingResponse != null)
{ {
return cachingResponse; return cachingResponse;
...@@ -607,8 +612,8 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -607,8 +612,8 @@ namespace Bailun.Discuz.Application.WeiPan
messageSb.Append($"新增帖子数量为:{inserWeiPanFileList.Count},分别为:{string.Join(",", inserWeiPanFileList.Select(u => u.FileName).ToArray()) };"); messageSb.Append($"新增帖子数量为:{inserWeiPanFileList.Count},分别为:{string.Join(",", inserWeiPanFileList.Select(u => u.FileName).ToArray()) };");
RedisHelper.Del(Constants.File_List_Tree);//清除缓存 RedisHelper.Del(Constants.File_List_Tree);//清除缓存
RedisHelper.Del(Constants.First_File_List);//清除缓存 RedisHelper.Del(Constants.First_File_List);//清除缓存
await CreateUserFilesTreeRedis();
} }
await CreateUserFilesTreeRedis();
_weiPanFileListRepository.BulkInsert(inserWeiPanFileList.ToArray()); _weiPanFileListRepository.BulkInsert(inserWeiPanFileList.ToArray());
var noTieZilist=await _weiPanFileListRepository.Query().AsNoTracking().Where(u => u.ThreadId == 0).ToListAsync(); var noTieZilist=await _weiPanFileListRepository.Query().AsNoTracking().Where(u => u.ThreadId == 0).ToListAsync();
foreach (var item in noTieZilist) foreach (var item in noTieZilist)
...@@ -664,8 +669,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -664,8 +669,7 @@ namespace Bailun.Discuz.Application.WeiPan
await _weipanUserFilesRepository.DeleteAsync(u => u.UserId == item.UserId); await _weipanUserFilesRepository.DeleteAsync(u => u.UserId == item.UserId);
foreach (var file in firstFiles.file_list.item) foreach (var file in firstFiles.file_list.item)
{ {
await GetFileListTree(item.UserId, file.fileid,false);
await GetFileListTree(item.UserId, file.fileid);
} }
await _weipanUserFilesRepository.BulkInsertAsync(weipanUserFileList.ToArray()); await _weipanUserFilesRepository.BulkInsertAsync(weipanUserFileList.ToArray());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment