Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
WeiPanAPI
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Discuz
WeiPanAPI
Commits
447b598d
Commit
447b598d
authored
Jan 23, 2021
by
xiongyuwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
895e911d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
7 deletions
+24
-7
FileListTreeDto.cs
src/Bailun.Discuz.Application/WeiPan/Dto/FileListTreeDto.cs
+2
-1
IWeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/IWeiPanService.cs
+1
-1
WeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
+15
-2
WeiPanController.cs
src/Bailun.Discuz.Service/Controllers/WeiPanController.cs
+6
-0
PublishWeiPanWorker.cs
...n.Discuz.ConsoleApp.Publish/Worker/PublishWeiPanWorker.cs
+0
-3
No files found.
src/Bailun.Discuz.Application/WeiPan/Dto/FileListTreeDto.cs
View file @
447b598d
...
...
@@ -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
;
}
}
}
src/Bailun.Discuz.Application/WeiPan/IWeiPanService.cs
View file @
447b598d
...
...
@@ -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
);
}
}
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
View file @
447b598d
...
...
@@ -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是否存在于数据库中, 如果不存在则添加
...
...
src/Bailun.Discuz.Service/Controllers/WeiPanController.cs
View file @
447b598d
...
...
@@ -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
);
}
}
}
src/console/Bailun.Discuz.ConsoleApp.Publish/Worker/PublishWeiPanWorker.cs
View file @
447b598d
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment