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
ae1cbf93
Commit
ae1cbf93
authored
Jan 26, 2021
by
xiongyuwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
e82a452a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
WeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
+10
-11
No files found.
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
View file @
ae1cbf93
...
@@ -224,13 +224,12 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -224,13 +224,12 @@ namespace Bailun.Discuz.Application.WeiPan
var
apiOutput
=
HttpHelper
.
PostAsync
<
GetFileListRequest
,
GetFileListResponse
>(
apiUrl
,
getFileListRequest
);
var
apiOutput
=
HttpHelper
.
PostAsync
<
GetFileListRequest
,
GetFileListResponse
>(
apiUrl
,
getFileListRequest
);
return
apiOutput
;
return
apiOutput
;
}
}
List
<
WeipanUserFiles
>
weipanUserFileList
=
null
;
/// <summary>
/// <summary>
/// 递归获取所有首页下的所有文件列表数据
/// 递归获取所有首页下的所有文件列表数据
/// </summary>
/// </summary>
public
async
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
fildId
)
public
async
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
fildId
)
{
{
weipanUserFileList
=
new
List
<
WeipanUserFiles
>();
List
<
FileListTreeDto
>
fileListTreeDtos
=
new
List
<
FileListTreeDto
>();
List
<
FileListTreeDto
>
fileListTreeDtos
=
new
List
<
FileListTreeDto
>();
//判断缓存中是否有值,如果有值直接读取
//判断缓存中是否有值,如果有值直接读取
var
redisKey
=
Constants
.
File_List_Tree
;
var
redisKey
=
Constants
.
File_List_Tree
;
...
@@ -270,7 +269,6 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -270,7 +269,6 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFiles
.
UserId
=
userId
;
weipanUserFiles
.
UserId
=
userId
;
weipanUserFiles
.
FatherFileId
=
fildId
;
weipanUserFiles
.
FatherFileId
=
fildId
;
weipanUserFiles
.
File_Id
=
u
.
fileid
;
weipanUserFiles
.
File_Id
=
u
.
fileid
;
weipanUserFileList
.
Add
(
weipanUserFiles
);
await
_weipanUserFilesRepository
.
AddAsync
(
weipanUserFiles
,
true
);
await
_weipanUserFilesRepository
.
AddAsync
(
weipanUserFiles
,
true
);
}
}
}
}
...
@@ -304,7 +302,6 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -304,7 +302,6 @@ namespace Bailun.Discuz.Application.WeiPan
{
{
throw
new
Exception
(
apiOutput
.
errmsg
);
throw
new
Exception
(
apiOutput
.
errmsg
);
}
}
_weipanUserFilesRepository
.
BulkInsert
(
weipanUserFileList
.
ToArray
());
RedisHelper
.
HSet
(
redisKey
,
userId
+
"_"
+
fildId
,
fileListTreeDtos
);
RedisHelper
.
HSet
(
redisKey
,
userId
+
"_"
+
fildId
,
fileListTreeDtos
);
}
}
return
fileListTreeDtos
;
return
fileListTreeDtos
;
...
@@ -327,7 +324,6 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -327,7 +324,6 @@ namespace Bailun.Discuz.Application.WeiPan
/// <param name="token"></param>
/// <param name="token"></param>
/// <param name="start"></param>
/// <param name="start"></param>
/// <returns></returns>
/// <returns></returns>
public
async
Task
<
List
<
FileListTreeDto
>>
GetChildrens
(
string
userId
,
string
fatherid
,
string
token
,
int
start
,
string
parentId
)
public
async
Task
<
List
<
FileListTreeDto
>>
GetChildrens
(
string
userId
,
string
fatherid
,
string
token
,
int
start
,
string
parentId
)
{
{
...
@@ -375,7 +371,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -375,7 +371,7 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFiles
.
UserId
=
userId
;
weipanUserFiles
.
UserId
=
userId
;
weipanUserFiles
.
FatherFileId
=
parentId
;
weipanUserFiles
.
FatherFileId
=
parentId
;
weipanUserFiles
.
File_Id
=
i
.
fileid
;
weipanUserFiles
.
File_Id
=
i
.
fileid
;
weipanUserFileList
.
Add
(
weipanUserFiles
);
await
_weipanUserFilesRepository
.
AddAsync
(
weipanUserFiles
,
true
);
}
}
}
}
}
}
...
@@ -666,16 +662,19 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -666,16 +662,19 @@ namespace Bailun.Discuz.Application.WeiPan
return
null
;
return
null
;
}
}
public
async
Task
<
List
<
string
>>
GetNoticeUserNames
(
string
fileId
)
public
async
Task
<
List
<
string
>>
GetNoticeUserNames
(
string
fileId
,
string
fileCreateUseid
)
{
{
List
<
string
>
result
=
new
List
<
string
>();
List
<
string
>
result
=
new
List
<
string
>();
var
userFiles
=
await
_weipanUserFilesRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
File_Id
==
fileId
).
ToListAsync
();
var
userFiles
=
await
_weipanUserFilesRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
File_Id
==
fileId
).
ToListAsync
();
foreach
(
var
item
in
userFiles
)
foreach
(
var
item
in
userFiles
)
{
{
var
user
=
await
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
i
=>
i
.
UserId
==
item
.
UserId
).
FirstOrDefaultAsync
();
if
(
item
.
UserId
!=
fileCreateUseid
)
if
(
user
!=
null
)
{
{
result
.
Add
(
"@"
+
user
.
UserName
);
var
user
=
await
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
i
=>
i
.
UserId
==
item
.
UserId
).
FirstOrDefaultAsync
();
if
(
user
!=
null
)
{
result
.
Add
(
"@"
+
user
.
UserName
);
}
}
}
}
}
return
result
;
return
result
;
...
@@ -717,7 +716,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -717,7 +716,7 @@ namespace Bailun.Discuz.Application.WeiPan
var
apiUrl
=
$"http://discuz.bailuntec.com/api/threads"
;
var
apiUrl
=
$"http://discuz.bailuntec.com/api/threads"
;
var
res
=
JsonHelper
.
ToObject
<
PublishTieZiResponse
>(
Client_Post
(
publishTieZiRequest
.
ToJson
(),
apiUrl
,
"Bearer "
+
token
));
var
res
=
JsonHelper
.
ToObject
<
PublishTieZiResponse
>(
Client_Post
(
publishTieZiRequest
.
ToJson
(),
apiUrl
,
"Bearer "
+
token
));
//通知对应的用户
//通知对应的用户
var
users
=
await
GetNoticeUserNames
(
weiPanFile
.
FileId
);
var
users
=
await
GetNoticeUserNames
(
weiPanFile
.
FileId
,
weiPanFile
.
FileCreateUseid
);
resultId
=
res
.
data
.
id
;
resultId
=
res
.
data
.
id
;
PostNoticeByNewTieZi
(
users
,
resultId
,
token
);
PostNoticeByNewTieZi
(
users
,
resultId
,
token
);
}
}
...
...
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