Commit 447b598d by xiongyuwen

no message

parent 895e911d
......@@ -12,7 +12,8 @@ namespace Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
public string md5 { get; set; }
public string leaf { get; set; }
public string icon { get; set; }
public string key { get; set; }
public List<FileListTreeDto> children { get; set; }
}
}
......@@ -49,7 +49,7 @@ namespace Bailun.Discuz.Application.WeiPan
Task<List<WeiPanFileList>> GetFileList();
Task<string> ProcessWeiPanWorker();
Task<WeiPanFileList> GetWeiPanFileByThreadId(long threadId);
Task<WeiPanFileList> GetFileInfo(string fileId);
}
}
......@@ -249,6 +249,7 @@ namespace Bailun.Discuz.Application.WeiPan
fileListTreeDto.file = u.file_type != 1 ? true : false;
fileListTreeDto.md5 = u.md5;
fileListTreeDto.icon = u.file_type == 1 ? "el-icon-folder-opened" : "el-icon-document";
fileListTreeDto.key= u.fileid;
fileListTreeDtos.Add(fileListTreeDto);
});
}
......@@ -271,6 +272,7 @@ namespace Bailun.Discuz.Application.WeiPan
fileListTreeDto.label = fileInfo.file_info.file_name;
fileListTreeDto.file = fileInfo.file_info.file_type != 1 ? true : false;
fileListTreeDto.md5 = fileInfo.file_info.md5;
fileListTreeDto.key = fildId;
fileListTreeDtos.Add(fileListTreeDto);
}
......@@ -336,6 +338,7 @@ namespace Bailun.Discuz.Application.WeiPan
fileListTreeDto.file = i.file_type != 1 ? true : false;
fileListTreeDto.md5 = i.md5;
fileListTreeDto.icon = i.file_type == 1 ? "el-icon-folder-opened" : "el-icon-document";
fileListTreeDto.key = i.fileid;
fileListTreeDtos.Add(fileListTreeDto);
});
}
......@@ -433,6 +436,16 @@ namespace Bailun.Discuz.Application.WeiPan
return await _weiPanFileListRepository.Query().AsNoTracking().Where(u => u.FileMd5 == md5).FirstOrDefaultAsync();
}
/// <summary>
/// 从数据库中获取对应得文件地址
/// </summary>
/// <param name="md5"></param>
/// <returns></returns>
public async Task<WeiPanFileList> GetWeiPanFileByThreadId(long threadId)
{
return await _weiPanFileListRepository.Query().AsNoTracking().Where(u => u.ThreadId == threadId).FirstOrDefaultAsync();
}
/// <summary>
/// 从数据库中获取对应的FileId
/// </summary>
/// <param name="md5"></param>
......@@ -464,8 +477,8 @@ namespace Bailun.Discuz.Application.WeiPan
//1:获取线上的所有文档数据
var filList=await GetFileList();
//string value = "测试数据";
//RedisHelper.Set("key", filList);
string value = "测试数据";
RedisHelper.Set("key", filList);
//List<WeiPanFileList> filList = RedisHelper.Get<List<WeiPanFileList>>("key");
//filList.RemoveAt(1);
//2:判断当前fileid是否存在于数据库中, 如果不存在则添加
......
......@@ -85,5 +85,11 @@ namespace Bailun.Discuz.Service.Controllers
{
return await _iweiPanService.GetFileInfo(fileId);
}
[HttpGet("GetWeiPanFileByThreadId")]
public async Task<WeiPanFileList> GetWeiPanFileByThreadId(long threadId)
{
return await _iweiPanService.GetWeiPanFileByThreadId(threadId);
}
}
}
......@@ -25,9 +25,6 @@ namespace Bailun.Discuz.ConsoleApp.Publish.Worker
{
try
{
RedisHelper.Del(Constants.File_List_Tree);//清除缓存
RedisHelper.Del(Constants.First_File_List);//清除缓存
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:开始生成帖子中");
var result= _weiPanService.ProcessWeiPanWorker().GetAwaiter().GetResult();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:生成帖子完毕,"+ result);
......
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