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
4f5f3589
Commit
4f5f3589
authored
Jan 25, 2021
by
xiongyuwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
f8caaf8e
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
305 additions
and
36 deletions
+305
-36
Constants.cs
src/Bailun.Discuz.Application/Util/Constants.cs
+2
-0
PostTieZiRelationships.cs
...plication/WeiPan/Dto/RequestDto/PostTieZiRelationships.cs
+32
-0
PostTieZiRequest.cs
...cuz.Application/WeiPan/Dto/RequestDto/PostTieZiRequest.cs
+41
-0
GetFileListResponse.cs
...Application/WeiPan/Dto/ResponseDto/GetFileListResponse.cs
+2
-0
WeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
+136
-36
IUsersRepository.cs
...un.Discuz.Domain/WeiPan/IRepositories/IUsersRepository.cs
+11
-0
IWeipanUserFilesRepository.cs
...Domain/WeiPan/IRepositories/IWeipanUserFilesRepository.cs
+11
-0
Users.cs
src/Bailun.Discuz.Domain/WeiPan/Users.cs
+18
-0
WeiPanFileList.cs
src/Bailun.Discuz.Domain/WeiPan/WeiPanFileList.cs
+4
-0
WeipanUserFiles.cs
src/Bailun.Discuz.Domain/WeiPan/WeipanUserFiles.cs
+19
-0
BaseContext.cs
src/Bailun.Discuz.EFCore/BaseContext.cs
+3
-0
UsersRepository.cs
...ilun.Discuz.EFCore/Repositories/WeiPan/UsersRepository.cs
+13
-0
WeipanUserFilesRepository.cs
...z.EFCore/Repositories/WeiPan/WeipanUserFilesRepository.cs
+13
-0
No files found.
src/Bailun.Discuz.Application/Util/Constants.cs
View file @
4f5f3589
...
@@ -10,5 +10,7 @@ namespace Bailun.Discuz.Application.Util
...
@@ -10,5 +10,7 @@ namespace Bailun.Discuz.Application.Util
public
const
string
File_List_Tree
=
"FileListTree"
;
public
const
string
File_List_Tree
=
"FileListTree"
;
public
const
string
File_Id_List
=
"FileIdList"
;
}
}
}
}
src/Bailun.Discuz.Application/WeiPan/Dto/RequestDto/PostTieZiRelationships.cs
0 → 100644
View file @
4f5f3589
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.Discuz.Application.WeiPan.Dto.RequestDto.PostTieZiRelationships
{
public
class
Relationships
{
public
Thread
thread
{
get
;
set
;
}
}
public
class
Thread
{
/// <summary>
///
/// </summary>
public
Data
data
{
get
;
set
;
}
}
public
class
Data
{
/// <summary>
///
/// </summary>
public
string
type
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
id
{
get
;
set
;
}
}
}
src/Bailun.Discuz.Application/WeiPan/Dto/RequestDto/PostTieZiRequest.cs
0 → 100644
View file @
4f5f3589
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.Discuz.Application.WeiPan.Dto
{
public
class
Attributes
{
/// <summary>
/// @陈泽凯 @熊裕文
/// </summary>
public
string
content
{
get
;
set
;
}
}
public
class
Data
{
/// <summary>
///
/// </summary>
public
string
type
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
RequestDto
.
PostTieZiRelationships
.
Relationships
relationships
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Attributes
attributes
{
get
;
set
;
}
}
public
class
PostTieZiRequest
{
/// <summary>
///
/// </summary>
public
Data
data
{
get
;
set
;
}
}
}
src/Bailun.Discuz.Application/WeiPan/Dto/ResponseDto/GetFileListResponse.cs
View file @
4f5f3589
...
@@ -6,6 +6,8 @@ namespace Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
...
@@ -6,6 +6,8 @@ namespace Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
{
{
public
class
ItemItem
public
class
ItemItem
{
{
public
string
firstfileid
{
get
;
set
;
}
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
...
...
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
View file @
4f5f3589
...
@@ -26,6 +26,7 @@ using Newtonsoft.Json;
...
@@ -26,6 +26,7 @@ using Newtonsoft.Json;
using
Bailun.Discuz.Application.Util
;
using
Bailun.Discuz.Application.Util
;
using
Abp.Domain.Uow
;
using
Abp.Domain.Uow
;
using
Abp.Domain.Services
;
using
Abp.Domain.Services
;
using
Users
=
Bailun
.
Discuz
.
Domain
.
WeiPan
.
Users
;
namespace
Bailun.Discuz.Application.WeiPan
namespace
Bailun.Discuz.Application.WeiPan
{
{
...
@@ -34,11 +35,17 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -34,11 +35,17 @@ namespace Bailun.Discuz.Application.WeiPan
{
{
private
readonly
IWeiPanFileListRepository
_weiPanFileListRepository
;
private
readonly
IWeiPanFileListRepository
_weiPanFileListRepository
;
private
readonly
IAttachmentsRepository
_attachmentsRepository
;
private
readonly
IAttachmentsRepository
_attachmentsRepository
;
private
readonly
IWeipanUserFilesRepository
_weipanUserFilesRepository
;
private
readonly
IUsersRepository
_usersRepository
;
private
readonly
IMapper
_mapper
;
private
readonly
IMapper
_mapper
;
public
WeiPanService
(
IWeiPanFileListRepository
weiPanFileListRepository
,
IMapper
mapper
,
IAttachmentsRepository
attachmentsRepository
)
public
WeiPanService
(
IWeiPanFileListRepository
weiPanFileListRepository
,
IMapper
mapper
,
IAttachmentsRepository
attachmentsRepository
,
IWeipanUserFilesRepository
weipanUserFilesRepository
,
IUsersRepository
usersRepository
)
{
{
_weiPanFileListRepository
=
weiPanFileListRepository
;
_weiPanFileListRepository
=
weiPanFileListRepository
;
_attachmentsRepository
=
attachmentsRepository
;
_attachmentsRepository
=
attachmentsRepository
;
_weipanUserFilesRepository
=
weipanUserFilesRepository
;
_usersRepository
=
usersRepository
;
_mapper
=
mapper
;
_mapper
=
mapper
;
}
}
public
async
Task
<
string
>
CreateSpace
(
string
userId
)
public
async
Task
<
string
>
CreateSpace
(
string
userId
)
...
@@ -120,7 +127,6 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -120,7 +127,6 @@ namespace Bailun.Discuz.Application.WeiPan
}
}
///// <summary>
///// <summary>
///// 获取首层文件列表
///// 获取首层文件列表
///// </summary>
///// </summary>
...
@@ -154,6 +160,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -154,6 +160,7 @@ namespace Bailun.Discuz.Application.WeiPan
//var request=getFileListRequest.ToJson();
//var request=getFileListRequest.ToJson();
if
(
apiOutput
.
file_list
!=
null
)
if
(
apiOutput
.
file_list
!=
null
)
{
{
apiOutput
.
file_list
.
item
=
apiOutput
.
file_list
.
item
.
Where
(
u
=>
u
.
file_status
==
"1"
).
ToList
();
//没被删除的文件
var
wxUserIdsResponse
=
CreateRealNameByUseId
(
apiOutput
.
file_list
.
item
.
GroupBy
(
u
=>
u
.
create_userid
).
Select
(
u
=>
u
.
Key
).
ToList
());
var
wxUserIdsResponse
=
CreateRealNameByUseId
(
apiOutput
.
file_list
.
item
.
GroupBy
(
u
=>
u
.
create_userid
).
Select
(
u
=>
u
.
Key
).
ToList
());
List
<
ResultItem
>
realNames
=
new
List
<
ResultItem
>();
List
<
ResultItem
>
realNames
=
new
List
<
ResultItem
>();
if
(
wxUserIdsResponse
.
statusCode
==
200
)
if
(
wxUserIdsResponse
.
statusCode
==
200
)
...
@@ -232,6 +239,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -232,6 +239,7 @@ namespace Bailun.Discuz.Application.WeiPan
}
}
else
else
{
{
await
_weipanUserFilesRepository
.
DeleteAsync
(
u
=>
u
.
UserId
==
userId
&&
u
.
FatherFileId
==
fildId
);
var
token
=
GetQYWeChatToken
(
userId
);
var
token
=
GetQYWeChatToken
(
userId
);
var
apiOutput
=
RequestFileList
(
userId
,
fildId
,
0
,
token
);
var
apiOutput
=
RequestFileList
(
userId
,
fildId
,
0
,
token
);
if
(
apiOutput
.
errcode
==
"0"
)
//获取成功
if
(
apiOutput
.
errcode
==
"0"
)
//获取成功
...
@@ -241,26 +249,38 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -241,26 +249,38 @@ namespace Bailun.Discuz.Application.WeiPan
var
files
=
apiOutput
.
file_list
.
item
;
var
files
=
apiOutput
.
file_list
.
item
;
if
(
files
!=
null
)
if
(
files
!=
null
)
{
{
f
iles
.
ForEach
(
u
=>
f
oreach
(
var
u
in
files
)
{
{
FileListTreeDto
fileListTreeDto
=
new
FileListTreeDto
();
if
(
u
.
file_status
==
"1"
)
//没被删除的文件
fileListTreeDto
.
id
=
u
.
fileid
;
{
fileListTreeDto
.
label
=
Path
.
GetFileNameWithoutExtension
(
u
.
file_name
);
FileListTreeDto
fileListTreeDto
=
new
FileListTreeDto
();
fileListTreeDto
.
file
=
u
.
file_type
!=
1
?
true
:
false
;
fileListTreeDto
.
id
=
u
.
fileid
;
fileListTreeDto
.
md5
=
u
.
md5
;
fileListTreeDto
.
label
=
Path
.
GetFileNameWithoutExtension
(
u
.
file_name
);
fileListTreeDto
.
icon
=
u
.
file_type
==
1
?
"el-icon-folder-opened"
:
"el-icon-document"
;
fileListTreeDto
.
file
=
u
.
file_type
!=
1
?
true
:
false
;
fileListTreeDto
.
key
=
u
.
fileid
;
fileListTreeDto
.
md5
=
u
.
md5
;
fileListTreeDtos
.
Add
(
fileListTreeDto
);
fileListTreeDto
.
icon
=
u
.
file_type
==
1
?
"el-icon-folder-opened"
:
"el-icon-document"
;
});
fileListTreeDto
.
key
=
u
.
fileid
;
fileListTreeDtos
.
Add
(
fileListTreeDto
);
}
if
(
u
.
file_type
!=
1
)
{
WeipanUserFiles
weipanUserFiles
=
new
WeipanUserFiles
();
weipanUserFiles
.
UserId
=
userId
;
weipanUserFiles
.
FatherFileId
=
fildId
;
weipanUserFiles
.
File_Id
=
u
.
fileid
;
await
_weipanUserFilesRepository
.
AddAsync
(
weipanUserFiles
,
true
);
}
}
}
}
//获取到第二层目录数据后获取每个子集数据
//获取到第二层目录数据后获取每个子集数据
if
(
fileListTreeDtos
.
Count
>
0
)
if
(
fileListTreeDtos
.
Count
>
0
)
{
{
f
ileListTreeDtos
.
ForEach
(
u
=>
f
oreach
(
var
u
in
fileListTreeDtos
)
{
{
u
.
children
=
GetChildrens
(
userId
,
u
.
id
,
token
,
0
);
u
.
children
=
await
GetChildrens
(
userId
,
u
.
id
,
token
,
0
,
fildId
);
});
}
}
}
}
}
else
else
...
@@ -303,7 +323,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -303,7 +323,7 @@ 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
List
<
FileListTreeDto
>
GetChildrens
(
string
userId
,
string
fatherid
,
string
token
,
int
start
)
public
async
Task
<
List
<
FileListTreeDto
>>
GetChildrens
(
string
userId
,
string
fatherid
,
string
token
,
int
start
,
string
parentId
)
{
{
List
<
FileListTreeDto
>
fileListTreeDtos
=
new
List
<
FileListTreeDto
>();
List
<
FileListTreeDto
>
fileListTreeDtos
=
new
List
<
FileListTreeDto
>();
...
@@ -330,17 +350,29 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -330,17 +350,29 @@ namespace Bailun.Discuz.Application.WeiPan
var
files
=
apiOutput
.
file_list
.
item
;
var
files
=
apiOutput
.
file_list
.
item
;
if
(
files
!=
null
)
if
(
files
!=
null
)
{
{
files
.
ForEach
(
i
=>
foreach
(
var
i
in
files
)
{
{
FileListTreeDto
fileListTreeDto
=
new
FileListTreeDto
();
if
(
i
.
file_status
==
"1"
)
//没被删除的文件
fileListTreeDto
.
id
=
i
.
fileid
;
{
fileListTreeDto
.
label
=
Path
.
GetFileNameWithoutExtension
(
i
.
file_name
);
FileListTreeDto
fileListTreeDto
=
new
FileListTreeDto
();
fileListTreeDto
.
file
=
i
.
file_type
!=
1
?
true
:
false
;
fileListTreeDto
.
id
=
i
.
fileid
;
fileListTreeDto
.
md5
=
i
.
md5
;
fileListTreeDto
.
label
=
Path
.
GetFileNameWithoutExtension
(
i
.
file_name
);
fileListTreeDto
.
icon
=
i
.
file_type
==
1
?
"el-icon-folder-opened"
:
"el-icon-document"
;
fileListTreeDto
.
file
=
i
.
file_type
!=
1
?
true
:
false
;
fileListTreeDto
.
key
=
i
.
fileid
;
fileListTreeDto
.
md5
=
i
.
md5
;
fileListTreeDtos
.
Add
(
fileListTreeDto
);
fileListTreeDto
.
icon
=
i
.
file_type
==
1
?
"el-icon-folder-opened"
:
"el-icon-document"
;
});
fileListTreeDto
.
key
=
i
.
fileid
;
fileListTreeDtos
.
Add
(
fileListTreeDto
);
}
if
(
i
.
file_type
!=
1
)
{
WeipanUserFiles
weipanUserFiles
=
new
WeipanUserFiles
();
weipanUserFiles
.
UserId
=
userId
;
weipanUserFiles
.
FatherFileId
=
parentId
;
weipanUserFiles
.
File_Id
=
i
.
fileid
;
await
_weipanUserFilesRepository
.
AddAsync
(
weipanUserFiles
,
true
);
}
}
}
}
}
}
else
else
...
@@ -350,7 +382,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -350,7 +382,7 @@ namespace Bailun.Discuz.Application.WeiPan
foreach
(
var
item
in
fileListTreeDtos
)
foreach
(
var
item
in
fileListTreeDtos
)
{
{
item
.
children
=
GetChildrens
(
userId
,
item
.
id
,
token
,
start
);
item
.
children
=
await
GetChildrens
(
userId
,
item
.
id
,
token
,
start
,
parentId
);
}
}
return
fileListTreeDtos
;
return
fileListTreeDtos
;
}
}
...
@@ -475,11 +507,11 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -475,11 +507,11 @@ namespace Bailun.Discuz.Application.WeiPan
string
userId
=
"chenzekai"
;
string
userId
=
"chenzekai"
;
List
<
WeiPanFileList
>
inserWeiPanFileList
=
new
List
<
WeiPanFileList
>();
List
<
WeiPanFileList
>
inserWeiPanFileList
=
new
List
<
WeiPanFileList
>();
//1:获取线上的所有文档数据
//1:获取线上的所有文档数据
var
filList
=
await
GetFileList
();
//
var filList=await GetFileList();
//string value = "测试数据";
//string value = "测试数据";
//RedisHelper.Set("key", filList);
//RedisHelper.Set("key", filList);
//
List<WeiPanFileList> filList = RedisHelper.Get<List<WeiPanFileList>>("key");
List
<
WeiPanFileList
>
filList
=
RedisHelper
.
Get
<
List
<
WeiPanFileList
>>(
"key"
);
//filList.RemoveAt(1);
//filList.RemoveAt(1);
//2:判断当前fileid是否存在于数据库中, 如果不存在则添加
//2:判断当前fileid是否存在于数据库中, 如果不存在则添加
foreach
(
var
file
in
filList
)
foreach
(
var
file
in
filList
)
...
@@ -539,6 +571,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -539,6 +571,7 @@ namespace Bailun.Discuz.Application.WeiPan
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
();
_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
)
...
@@ -551,16 +584,75 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -551,16 +584,75 @@ namespace Bailun.Discuz.Application.WeiPan
await
_weiPanFileListRepository
.
UpdateAsync
(
item
);
await
_weiPanFileListRepository
.
UpdateAsync
(
item
);
}
}
}
}
filList
=
null
;
return
messageSb
.
Length
==
0
?
"无新增帖子"
:
messageSb
.
ToString
();
return
messageSb
.
Length
==
0
?
"无新增帖子"
:
messageSb
.
ToString
();
}
}
public
void
PostNoticeByNewTieZi
(
List
<
string
>
userNames
,
string
threadId
,
string
token
)
{
if
(
userNames
.
Any
())
{
PostTieZiRequest
postTieZiRequest
=
new
PostTieZiRequest
();
postTieZiRequest
.
data
=
new
Dto
.
Data
();
postTieZiRequest
.
data
.
attributes
=
new
Dto
.
Attributes
();
postTieZiRequest
.
data
.
attributes
.
content
=
string
.
Join
(
" "
,
userNames
);
postTieZiRequest
.
data
.
relationships
=
new
Dto
.
RequestDto
.
PostTieZiRelationships
.
Relationships
();
postTieZiRequest
.
data
.
relationships
.
thread
=
new
Dto
.
RequestDto
.
PostTieZiRelationships
.
Thread
();
postTieZiRequest
.
data
.
relationships
.
thread
.
data
=
new
Dto
.
RequestDto
.
PostTieZiRelationships
.
Data
();
postTieZiRequest
.
data
.
relationships
.
thread
.
data
.
id
=
threadId
;
postTieZiRequest
.
data
.
relationships
.
thread
.
data
.
type
=
"threads"
;
var
apiUrl
=
$"http://discuz.bailuntec.com/api/posts"
;
var
res
=
Client_Post
(
postTieZiRequest
.
ToJson
(),
apiUrl
,
"Bearer "
+
token
);
}
}
/// <summary>
/// 创建缓存数据
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public
async
Task
<
string
>
CreateUserFilesTreeRedis
()
{
var
userList
=
await
_usersRepository
.
Query
().
AsNoTracking
().
ToListAsync
();
foreach
(
var
item
in
userList
)
{
if
(
item
.
UserId
!=
null
)
{
List
<
string
>
fileIds
=
new
List
<
string
>();
//获取用户对于的首层文件列表
var
firstFiles
=
await
GetFirstFileList
(
item
.
UserId
);
if
(
firstFiles
.
file_list
!=
null
)
{
foreach
(
var
file
in
firstFiles
.
file_list
.
item
)
{
await
GetFileListTree
(
item
.
UserId
,
file
.
fileid
);
}
}
}
}
return
null
;
}
public
async
Task
<
List
<
string
>>
GetNoticeUserNames
(
string
fileId
)
{
List
<
string
>
result
=
new
List
<
string
>();
var
userFiles
=
await
_weipanUserFilesRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
File_Id
==
fileId
).
ToListAsync
();
foreach
(
var
item
in
userFiles
)
{
var
user
=
await
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
i
=>
i
.
UserId
==
item
.
UserId
).
FirstOrDefaultAsync
();
if
(
user
!=
null
)
{
result
.
Add
(
"@"
+
user
.
UserName
);
}
}
return
result
;
}
public
async
Task
<
string
>
PublishTieZi
(
WeiPanFileList
weiPanFile
)
public
async
Task
<
string
>
PublishTieZi
(
WeiPanFileList
weiPanFile
)
{
{
string
resultId
=
""
;
string
resultId
=
""
;
//获取token
//获取token
var
response
=
HttpHelper
.
HttpGet
(
"http://discuz.bailuntec.com/api/login?useid=chenzekai
"
);
var
response
=
HttpHelper
.
HttpGet
(
$"http://discuz.bailuntec.com/api/login?useid=
{
weiPanFile
.
FileCreateUseid
}
"
);
var
result
=
JsonHelper
.
FromJson
<
GetDiscuzTokenRespnse
>(
response
);
var
result
=
JsonHelper
.
FromJson
<
GetDiscuzTokenRespnse
>(
response
);
var
token
=
result
.
data
.
attributes
.
access_token
;
var
token
=
result
.
data
.
attributes
.
access_token
;
//生成附件
//生成附件
...
@@ -592,7 +684,11 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -592,7 +684,11 @@ namespace Bailun.Discuz.Application.WeiPan
publishTieZiRequest
.
data
=
data
;
publishTieZiRequest
.
data
=
data
;
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
);
resultId
=
res
.
data
.
id
;
resultId
=
res
.
data
.
id
;
PostNoticeByNewTieZi
(
users
,
resultId
,
token
);
}
}
return
resultId
;
return
resultId
;
}
}
...
@@ -603,7 +699,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -603,7 +699,7 @@ namespace Bailun.Discuz.Application.WeiPan
/// <param name="requestUri">请求地址</param>
/// <param name="requestUri">请求地址</param>
/// <param name="token">身份验证秘钥,可为空</param>
/// <param name="token">身份验证秘钥,可为空</param>
/// <returns></returns>
/// <returns></returns>
public
string
Client_Post
(
string
formData
,
string
requestUri
,
string
token
)
public
string
Client_Post
(
string
formData
,
string
requestUri
,
string
token
)
{
{
var
client
=
new
HttpClient
();
var
client
=
new
HttpClient
();
//添加请求头
//添加请求头
...
@@ -615,7 +711,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -615,7 +711,7 @@ namespace Bailun.Discuz.Application.WeiPan
var
content
=
new
ByteArrayContent
(
data
);
var
content
=
new
ByteArrayContent
(
data
);
content
.
Headers
.
ContentType
=
new
MediaTypeHeaderValue
(
"application/json"
);
content
.
Headers
.
ContentType
=
new
MediaTypeHeaderValue
(
"application/json"
);
HttpResponseMessage
response
=
client
.
PostAsync
(
requestUri
,
content
).
Result
;
HttpResponseMessage
response
=
client
.
PostAsync
(
requestUri
,
content
).
Result
;
return
response
.
Content
.
ReadAsStringAsync
().
Result
;
return
response
.
Content
.
ReadAsStringAsync
().
Result
;
}
}
List
<
ItemItem
>
fileItems
=
new
List
<
ItemItem
>();
List
<
ItemItem
>
fileItems
=
new
List
<
ItemItem
>();
...
@@ -628,7 +724,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -628,7 +724,7 @@ 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
List
<
ItemItem
>
GetChildrensItem
(
string
userId
,
string
fatherid
,
string
token
,
int
start
)
public
List
<
ItemItem
>
GetChildrensItem
(
string
userId
,
string
fatherid
,
string
token
,
int
start
,
string
firstFileId
)
{
{
var
apiOutput
=
RequestFileList
(
userId
,
fatherid
,
start
,
token
);
var
apiOutput
=
RequestFileList
(
userId
,
fatherid
,
start
,
token
);
...
@@ -641,6 +737,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -641,6 +737,7 @@ namespace Bailun.Discuz.Application.WeiPan
{
{
if
(
i
.
file_type
!=
1
&&
i
.
file_status
==
"1"
)
if
(
i
.
file_type
!=
1
&&
i
.
file_status
==
"1"
)
{
{
i
.
firstfileid
=
firstFileId
;
fileItems
.
Add
(
i
);
fileItems
.
Add
(
i
);
}
}
...
@@ -656,7 +753,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -656,7 +753,7 @@ namespace Bailun.Discuz.Application.WeiPan
foreach
(
var
item
in
nextItems
)
foreach
(
var
item
in
nextItems
)
{
{
GetChildrensItem
(
userId
,
item
.
fileid
,
token
,
start
);
GetChildrensItem
(
userId
,
item
.
fileid
,
token
,
start
,
firstFileId
);
}
}
return
fileItems
;
return
fileItems
;
}
}
...
@@ -674,13 +771,14 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -674,13 +771,14 @@ namespace Bailun.Discuz.Application.WeiPan
{
{
firstFiles
.
file_list
.
item
.
ForEach
(
u
=>
firstFiles
.
file_list
.
item
.
ForEach
(
u
=>
{
{
u
.
firstfileid
=
u
.
fileid
;
if
(
u
.
file_type
!=
1
&&
u
.
file_status
==
"1"
)
//说明是文件
if
(
u
.
file_type
!=
1
&&
u
.
file_status
==
"1"
)
//说明是文件
{
{
itemItems
.
Add
(
u
);
itemItems
.
Add
(
u
);
}
}
else
else
{
{
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
);
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
,
u
.
firstfileid
);
}
}
});
});
...
@@ -692,7 +790,9 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -692,7 +790,9 @@ namespace Bailun.Discuz.Application.WeiPan
weiPanFile
.
FileId
=
u
.
fileid
;
weiPanFile
.
FileId
=
u
.
fileid
;
weiPanFile
.
FileMd5
=
u
.
md5
;
weiPanFile
.
FileMd5
=
u
.
md5
;
weiPanFile
.
FileName
=
u
.
file_name
;
weiPanFile
.
FileName
=
u
.
file_name
;
weiPanFile
.
FirstFileId
=
u
.
firstfileid
;
weiPanFile
.
QiniuUrl
=
""
;
weiPanFile
.
QiniuUrl
=
""
;
weiPanFile
.
FileCreateUseid
=
u
.
create_userid
;
weiPanFileLists
.
Add
(
weiPanFile
);
weiPanFileLists
.
Add
(
weiPanFile
);
});
});
return
weiPanFileLists
;
return
weiPanFileLists
;
...
...
src/Bailun.Discuz.Domain/WeiPan/IRepositories/IUsersRepository.cs
0 → 100644
View file @
4f5f3589
using
Bailun.AbpCore.Domain
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.Discuz.Domain.WeiPan.IRepositories
{
public
interface
IUsersRepository
:
IRepositoryExtension
<
Users
,
long
>
{
}
}
src/Bailun.Discuz.Domain/WeiPan/IRepositories/IWeipanUserFilesRepository.cs
0 → 100644
View file @
4f5f3589
using
Bailun.AbpCore.Domain
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.Discuz.Domain.WeiPan.IRepositories
{
public
interface
IWeipanUserFilesRepository
:
IRepositoryExtension
<
WeipanUserFiles
,
long
>
{
}
}
src/Bailun.Discuz.Domain/WeiPan/Users.cs
0 → 100644
View file @
4f5f3589
using
Abp.Domain.Entities
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel.DataAnnotations.Schema
;
using
System.Text
;
namespace
Bailun.Discuz.Domain.WeiPan
{
public
class
Users
:
Entity
<
long
>
{
[
Column
(
"id"
)]
public
override
long
Id
{
get
;
set
;
}
[
Column
(
"username"
)]
public
string
UserName
{
get
;
set
;
}
[
Column
(
"userid"
)]
public
string
UserId
{
get
;
set
;
}
}
}
src/Bailun.Discuz.Domain/WeiPan/WeiPanFileList.cs
View file @
4f5f3589
...
@@ -21,5 +21,9 @@ namespace Bailun.Discuz.Domain.WeiPan
...
@@ -21,5 +21,9 @@ namespace Bailun.Discuz.Domain.WeiPan
[
Column
(
"qiniu_url"
)]
public
string
QiniuUrl
{
get
;
set
;
}
[
Column
(
"qiniu_url"
)]
public
string
QiniuUrl
{
get
;
set
;
}
[
Column
(
"thread_id"
)]
public
long
ThreadId
{
get
;
set
;
}
[
Column
(
"thread_id"
)]
public
long
ThreadId
{
get
;
set
;
}
[
Column
(
"first_file_id"
)]
public
string
FirstFileId
{
get
;
set
;
}
[
Column
(
"file_create_useid"
)]
public
string
FileCreateUseid
{
get
;
set
;
}
}
}
}
}
src/Bailun.Discuz.Domain/WeiPan/WeipanUserFiles.cs
0 → 100644
View file @
4f5f3589
using
Abp.Domain.Entities
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel.DataAnnotations.Schema
;
using
System.Text
;
namespace
Bailun.Discuz.Domain.WeiPan
{
public
class
WeipanUserFiles
:
Entity
<
long
>
{
[
Column
(
"id"
)]
public
override
long
Id
{
get
;
set
;
}
[
Column
(
"user_id"
)]
public
string
UserId
{
get
;
set
;
}
[
Column
(
"father_file_id"
)]
public
string
FatherFileId
{
get
;
set
;
}
[
Column
(
"file_id"
)]
public
string
File_Id
{
get
;
set
;
}
}
}
src/Bailun.Discuz.EFCore/BaseContext.cs
View file @
4f5f3589
...
@@ -16,7 +16,10 @@ namespace Bailun.Discuz
...
@@ -16,7 +16,10 @@ namespace Bailun.Discuz
{
{
modelBuilder
.
Entity
<
WeiPanFileList
>(
pc
=>
pc
.
ToTable
(
"dis_weipan_file_list"
).
HasKey
(
k
=>
k
.
Id
));
modelBuilder
.
Entity
<
WeiPanFileList
>(
pc
=>
pc
.
ToTable
(
"dis_weipan_file_list"
).
HasKey
(
k
=>
k
.
Id
));
modelBuilder
.
Entity
<
Attachments
>(
pc
=>
pc
.
ToTable
(
"dis_attachments"
).
HasKey
(
k
=>
k
.
Id
));
modelBuilder
.
Entity
<
Attachments
>(
pc
=>
pc
.
ToTable
(
"dis_attachments"
).
HasKey
(
k
=>
k
.
Id
));
modelBuilder
.
Entity
<
WeipanUserFiles
>(
pc
=>
pc
.
ToTable
(
"dis_weipan_user_files"
).
HasKey
(
k
=>
k
.
Id
));
modelBuilder
.
Entity
<
Users
>(
pc
=>
pc
.
ToTable
(
"dis_users"
).
HasKey
(
k
=>
k
.
Id
));
base
.
OnModelCreating
(
modelBuilder
);
base
.
OnModelCreating
(
modelBuilder
);
}
}
}
}
}
}
src/Bailun.Discuz.EFCore/Repositories/WeiPan/UsersRepository.cs
0 → 100644
View file @
4f5f3589
using
Abp.EntityFrameworkCore
;
using
Bailun.AbpCore.EFCore
;
using
Bailun.Discuz.Domain.WeiPan
;
using
Bailun.Discuz.Domain.WeiPan.IRepositories
;
namespace
Bailun.Discuz.EFCore.Repositories.WeiPan
{
public
class
UsersRepository
:
RepositoryBase
<
Users
,
long
,
BaseContext
>,
IUsersRepository
{
public
UsersRepository
(
IDbContextProvider
<
BaseContext
>
dbContextProvider
)
:
base
(
dbContextProvider
)
{
}
}
}
src/Bailun.Discuz.EFCore/Repositories/WeiPan/WeipanUserFilesRepository.cs
0 → 100644
View file @
4f5f3589
using
Abp.EntityFrameworkCore
;
using
Bailun.AbpCore.EFCore
;
using
Bailun.Discuz.Domain.WeiPan
;
using
Bailun.Discuz.Domain.WeiPan.IRepositories
;
namespace
Bailun.Discuz.EFCore.Repositories.WeiPan
{
public
class
WeipanUserFilesRepository
:
RepositoryBase
<
WeipanUserFiles
,
long
,
BaseContext
>,
IWeipanUserFilesRepository
{
public
WeipanUserFilesRepository
(
IDbContextProvider
<
BaseContext
>
dbContextProvider
)
:
base
(
dbContextProvider
)
{
}
}
}
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