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
3d04a6da
Commit
3d04a6da
authored
May 12, 2021
by
xiongyuwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
36904722
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
149 additions
and
65 deletions
+149
-65
GetFileListResponse.cs
...Application/WeiPan/Dto/ResponseDto/GetFileListResponse.cs
+1
-0
IWeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/IWeiPanService.cs
+2
-2
WeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
+105
-57
WeipanUserFiles.cs
src/Bailun.Discuz.Domain/WeiPan/WeipanUserFiles.cs
+1
-0
WeiPanController.cs
src/Bailun.Discuz.Service/Controllers/WeiPanController.cs
+4
-4
appsettings.Production.json
...lun.Discuz.ConsoleApp.Publish/appsettings.Production.json
+28
-0
appsettings.json
...console/Bailun.Discuz.ConsoleApp.Publish/appsettings.json
+8
-2
No files found.
src/Bailun.Discuz.Application/WeiPan/Dto/ResponseDto/GetFileListResponse.cs
View file @
3d04a6da
...
...
@@ -97,5 +97,6 @@ namespace Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
///
/// </summary>
public
File_list
file_list
{
get
;
set
;
}
public
string
companyName
{
get
;
set
;
}
}
}
src/Bailun.Discuz.Application/WeiPan/IWeiPanService.cs
View file @
3d04a6da
...
...
@@ -30,7 +30,7 @@ namespace Bailun.Discuz.Application.WeiPan
///// 获取首层文件列表
///// </summary>
///// <returns></returns>
Task
<
GetFileListResponse
>
GetFirstFileList
(
string
userId
,
bool
isGetRedis
=
tru
e
);
Task
<
GetFileListResponse
>
GetFirstFileList
(
string
userId
,
string
companyName
,
bool
isGetRedis
=
true
,
bool
isDelCaching
=
fals
e
);
///// <summary>
///// 获取下载文件链接地址
...
...
@@ -41,7 +41,7 @@ namespace Bailun.Discuz.Application.WeiPan
/// <summary>
/// 递归获取所有首页下的所有文件列表数据
/// </summary>
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
fildId
,
bool
isGetRedis
=
tru
e
);
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
companyName
,
string
fildId
,
bool
isGetRedis
=
true
,
bool
isDelCaching
=
fals
e
);
Task
<
AttachmentsDto
>
GetAttchmattachmentByFileId
(
string
fileId
);
...
...
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
View file @
3d04a6da
...
...
@@ -70,7 +70,7 @@ namespace Bailun.Discuz.Application.WeiPan
var
token
=
GetQYWeChatToken
(
userId
);
string
apiUrl
=
$"https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_create?access_token=
{
token
}
"
;
CreateSpaceFileRequest
createSpaceFileRequest
=
new
CreateSpaceFileRequest
();
var
weiPanSpaceId
=
GetWeiPanSpaceId
(
userId
);
var
weiPanSpaceId
=
GetWeiPanSpaceId
(
userId
,
"四千里数据科技有限公司"
);
createSpaceFileRequest
.
fatherid
=
weiPanSpaceId
;
createSpaceFileRequest
.
file_name
=
"4k共享文件"
;
createSpaceFileRequest
.
file_type
=
1
;
...
...
@@ -130,17 +130,22 @@ namespace Bailun.Discuz.Application.WeiPan
///// <summary>
///// 获取首层文件列表
////广州百伦供应链科技有限公司\四千里数据科技有限公司
///// </summary>
///// <returns></returns>
public
async
Task
<
GetFileListResponse
>
GetFirstFileList
(
string
userId
,
bool
isGetRedis
=
tru
e
)
public
async
Task
<
GetFileListResponse
>
GetFirstFileList
(
string
userId
,
string
companyName
,
bool
isGetRedis
=
true
,
bool
isDelCaching
=
fals
e
)
{
//判断缓存中是否有值,如果有值直接读取
var
redisKey
=
Constants
.
First_File_List
;
var
redisKey
=
Constants
.
First_File_List
+
companyName
;
GetFileListResponse
cachingResponse
=
null
;
if
(
isDelCaching
)
{
RedisHelper
.
HDel
(
redisKey
,
$"
{
userId
}
_
{
companyName
}
"
);
}
if
(
isGetRedis
)
{
cachingResponse
=
RedisHelper
.
HGet
<
GetFileListResponse
>(
redisKey
,
userId
);
cachingResponse
=
RedisHelper
.
HGet
<
GetFileListResponse
>(
redisKey
,
$"
{
userId
}
_
{
companyName
}
"
);
}
if
(
cachingResponse
!=
null
)
{
...
...
@@ -157,13 +162,13 @@ namespace Bailun.Discuz.Application.WeiPan
else
{
GetFileListRequest
getFileListRequest
=
new
GetFileListRequest
();
getFileListRequest
.
fatherid
=
GetWeiPanSpaceFileId
(
userId
);
getFileListRequest
.
fatherid
=
GetWeiPanSpaceFileId
(
userId
,
companyName
);
getFileListRequest
.
userid
=
userId
;
getFileListRequest
.
spaceid
=
GetWeiPanSpaceId
(
userId
);
getFileListRequest
.
spaceid
=
GetWeiPanSpaceId
(
userId
,
companyName
);
getFileListRequest
.
sort_type
=
6
;
getFileListRequest
.
start
=
0
;
getFileListRequest
.
limit
=
1000
;
var
token
=
GetQYWeChatToken
(
userId
);
var
token
=
GetQYWeChatToken
(
userId
,
companyName
);
var
apiUrl
=
$"https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_list?access_token=
{
token
}
"
;
var
apiOutput
=
HttpHelper
.
PostAsync
<
GetFileListRequest
,
GetFileListResponse
>(
apiUrl
,
getFileListRequest
);
//var request=getFileListRequest.ToJson();
...
...
@@ -182,17 +187,18 @@ namespace Bailun.Discuz.Application.WeiPan
{
u
.
file_name
=
u
.
file_name
.
Split
(
'-'
)[
1
];
}
var
user
=
realNames
.
Where
(
r
=>
r
.
wxUserId
==
u
.
create_userid
).
FirstOrDefault
();
var
user
=
realNames
.
Where
(
r
=>
r
.
wxUserId
==
u
.
create_userid
.
ToLower
()
).
FirstOrDefault
();
if
(
user
!=
null
)
{
u
.
create_user_name
=
user
.
userName
;
}
else
{
u
.
create_user_name
=
u
ser
.
wxUserI
d
;
u
.
create_user_name
=
u
.
create_useri
d
;
}
u
.
ctime
=
ConvertToDateTime
(
u
.
ctime
);
});
apiOutput
.
companyName
=
companyName
;
}
if
(
isGetRedis
)
RedisHelper
.
HSet
(
redisKey
,
userId
,
apiOutput
);
...
...
@@ -223,12 +229,12 @@ namespace Bailun.Discuz.Application.WeiPan
///// 获取首层下的对应树状内容
///// </summary>
///// <returns></returns>
public
GetFileListResponse
RequestFileList
(
string
userId
,
string
fatherid
,
int
start
,
string
token
)
public
GetFileListResponse
RequestFileList
(
string
userId
,
string
fatherid
,
int
start
,
string
token
,
string
companyName
)
{
GetFileListRequest
getFileListRequest
=
new
GetFileListRequest
();
getFileListRequest
.
fatherid
=
fatherid
;
;
getFileListRequest
.
userid
=
userId
;
getFileListRequest
.
spaceid
=
GetWeiPanSpaceId
(
userId
);;
getFileListRequest
.
spaceid
=
GetWeiPanSpaceId
(
userId
,
companyName
);;
getFileListRequest
.
sort_type
=
6
;
getFileListRequest
.
start
=
start
;
getFileListRequest
.
limit
=
1000
;
...
...
@@ -243,12 +249,16 @@ namespace Bailun.Discuz.Application.WeiPan
/// <summary>
/// 递归获取所有首页下的所有文件列表数据
/// </summary>
public
async
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
fildId
,
bool
isGetRedis
=
tru
e
)
public
async
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
companyName
,
string
fildId
,
bool
isGetRedis
=
true
,
bool
isDelCaching
=
fals
e
)
{
List
<
FileListTreeDto
>
fileListTreeDtos
=
new
List
<
FileListTreeDto
>();
List
<
FileListTreeDto
>
cachingResponse
=
null
;
//判断缓存中是否有值,如果有值直接读取
var
redisKey
=
Constants
.
File_List_Tree
;
var
redisKey
=
Constants
.
File_List_Tree
+
companyName
;
if
(
isDelCaching
)
{
RedisHelper
.
HDel
(
redisKey
,
userId
+
"_"
+
fildId
);
}
if
(
isGetRedis
)
{
cachingResponse
=
RedisHelper
.
HGet
<
List
<
FileListTreeDto
>>(
redisKey
,
userId
+
"_"
+
fildId
);
...
...
@@ -261,8 +271,8 @@ namespace Bailun.Discuz.Application.WeiPan
else
{
//await _weipanUserFilesRepository.DeleteAsync(u => u.UserId ==userId&&u.FatherFileId==fildId);
var
token
=
GetQYWeChatToken
(
userId
);
var
apiOutput
=
RequestFileList
(
userId
,
fildId
,
0
,
token
);
var
token
=
GetQYWeChatToken
(
userId
,
companyName
);
var
apiOutput
=
RequestFileList
(
userId
,
fildId
,
0
,
token
,
companyName
);
if
(
apiOutput
.
errcode
==
"0"
)
//获取成功
{
if
(
apiOutput
.
file_list
!=
null
)
...
...
@@ -289,6 +299,7 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFiles
.
UserId
=
userId
;
weipanUserFiles
.
FatherFileId
=
fildId
;
weipanUserFiles
.
File_Id
=
u
.
fileid
;
weipanUserFiles
.
Company_Name
=
companyName
;
if
(
weipanUserFileList
!=
null
)
weipanUserFileList
.
Add
(
weipanUserFiles
);
...
...
@@ -302,7 +313,7 @@ namespace Bailun.Discuz.Application.WeiPan
{
foreach
(
var
u
in
fileListTreeDtos
)
{
u
.
children
=
await
GetChildrens
(
userId
,
u
.
id
,
token
,
0
,
fildId
);
u
.
children
=
await
GetChildrens
(
userId
,
u
.
id
,
token
,
0
,
fildId
,
companyName
);
}
}
...
...
@@ -348,7 +359,7 @@ namespace Bailun.Discuz.Application.WeiPan
/// <param name="token"></param>
/// <param name="start"></param>
/// <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
,
string
companyName
)
{
List
<
FileListTreeDto
>
fileListTreeDtos
=
new
List
<
FileListTreeDto
>();
...
...
@@ -369,7 +380,7 @@ namespace Bailun.Discuz.Application.WeiPan
//fileListTreeDtos.Add(fileListTreeDto2);
//return fileListTreeDtos;
#
endregion
var
apiOutput
=
RequestFileList
(
userId
,
fatherid
,
start
,
token
);
var
apiOutput
=
RequestFileList
(
userId
,
fatherid
,
start
,
token
,
companyName
);
if
(
apiOutput
.
file_list
!=
null
)
{
var
files
=
apiOutput
.
file_list
.
item
;
...
...
@@ -395,6 +406,7 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFiles
.
UserId
=
userId
;
weipanUserFiles
.
FatherFileId
=
parentId
;
weipanUserFiles
.
File_Id
=
i
.
fileid
;
weipanUserFiles
.
Company_Name
=
companyName
;
if
(
weipanUserFileList
!=
null
)
weipanUserFileList
.
Add
(
weipanUserFiles
);
//await _weipanUserFilesRepository.AddAsync(weipanUserFiles, true);
...
...
@@ -409,7 +421,7 @@ namespace Bailun.Discuz.Application.WeiPan
foreach
(
var
item
in
fileListTreeDtos
)
{
item
.
children
=
await
GetChildrens
(
userId
,
item
.
id
,
token
,
start
,
parentId
);
item
.
children
=
await
GetChildrens
(
userId
,
item
.
id
,
token
,
start
,
parentId
,
companyName
);
}
return
fileListTreeDtos
;
}
...
...
@@ -442,7 +454,8 @@ namespace Bailun.Discuz.Application.WeiPan
//上传至七牛云中
if
(
apiOutput
.
errcode
==
0
)
{
if
(!
IsVideoFile
(
apiOutput
.
download_url
))
{
Dictionary
<
string
,
string
>
parameters
=
new
Dictionary
<
string
,
string
>();
CookieContainer
cookieContainer
=
new
CookieContainer
();
Cookie
cookie
=
new
Cookie
(
apiOutput
.
cookie_name
,
apiOutput
.
cookie_value
);
...
...
@@ -455,6 +468,7 @@ namespace Bailun.Discuz.Application.WeiPan
//{
// cookie.Domain ="szfront.wxwork.qq.com";
//}
Uri
uri
=
new
Uri
(
apiOutput
.
download_url
);
cookie
.
Domain
=
uri
.
Host
;
...
...
@@ -487,7 +501,7 @@ namespace Bailun.Discuz.Application.WeiPan
{
throw
new
Exception
(
result
.
RefText
);
}
}
}
else
{
...
...
@@ -502,7 +516,19 @@ namespace Bailun.Discuz.Application.WeiPan
}
return
fileUrl
;
}
public
bool
IsVideoFile
(
string
url
)
{
bool
isVideo
=
false
;
IList
<
string
>
formateList
=
new
List
<
string
>
{
"avi"
,
"flv"
,
"mpg"
,
"mpeg"
,
"mpe"
,
"m1v"
,
"m2v"
,
"mpv2"
,
"mp2v"
,
"dat"
,
"ts"
,
"tp"
,
"tpr"
,
"pva"
,
"pss"
,
"mp4"
,
"m4v"
,
"m4p"
,
"m4b"
,
"3gp"
,
"3gpp"
,
"3g2"
,
"3gp2"
,
"ogg"
,
"mov"
,
"qt"
,
"amr"
,
"rm"
,
"ram"
,
"rmvb"
,
"rpm"
,
"mpeg4"
,
"mkv"
,
"flv"
};
string
extName
=
Path
.
GetExtension
(
url
).
Replace
(
"."
,
""
);
if
(
formateList
.
Contains
(
extName
))
{
isVideo
=
true
;
}
return
isVideo
;
}
/// <summary>
/// 从数据库中获取对应得文件地址
/// </summary>
...
...
@@ -595,9 +621,12 @@ namespace Bailun.Discuz.Application.WeiPan
return
companyName
;
}
public
string
GetWeiPanSpaceFileId
(
string
userId
)
public
string
GetWeiPanSpaceFileId
(
string
userId
,
string
companyName
)
{
if
(
string
.
IsNullOrEmpty
(
companyName
))
{
string
companyName
=
GetCompanyName
(
userId
);
companyName
=
GetCompanyName
(
userId
);
}
if
(
companyName
==
"广州百伦供应链科技有限公司"
)
{
return
ConfigManagerConf
.
GetValue
(
"QYWeChat:WeiPanSpaceFileId"
);
...
...
@@ -607,9 +636,12 @@ namespace Bailun.Discuz.Application.WeiPan
return
ConfigManagerConf
.
GetValue
(
"FourKQYWeChat:WeiPanSpaceFileId"
);
}
}
public
string
GetWeiPanSpaceId
(
string
userId
)
public
string
GetWeiPanSpaceId
(
string
userId
,
string
companyName
)
{
if
(
string
.
IsNullOrEmpty
(
companyName
))
{
string
companyName
=
GetCompanyName
(
userId
);
companyName
=
GetCompanyName
(
userId
);
}
if
(
companyName
==
"广州百伦供应链科技有限公司"
)
{
return
ConfigManagerConf
.
GetValue
(
"QYWeChat:WeiPanSpaceId"
);
...
...
@@ -683,11 +715,11 @@ namespace Bailun.Discuz.Application.WeiPan
// string userId = "chenzekai";
List
<
WeiPanFileList
>
inserWeiPanFileList
=
new
List
<
WeiPanFileList
>();
//1:获取线上的所有文档数据
var
filList
=
await
GetFileList
(
userId
,
companyName
);
//调试注释
//
var filList=await GetFileList(userId,companyName);//调试注释
//string value = "测试数据";
//RedisHelper.Set("key", filList);
//
List<WeiPanFileList> filList = RedisHelper.Get<List<WeiPanFileList>>("key");
List
<
WeiPanFileList
>
filList
=
RedisHelper
.
Get
<
List
<
WeiPanFileList
>>(
"key"
);
//filList.RemoveAt(1);
//2:判断当前fileid是否存在于数据库中, 如果不存在则添加
foreach
(
var
file
in
filList
)
...
...
@@ -750,8 +782,8 @@ namespace Bailun.Discuz.Application.WeiPan
{
messageSb
.
Append
(
$"新增帖子数量为:
{
inserWeiPanFileList
.
Count
}
,分别为:
{
string
.
Join
(
","
,
inserWeiPanFileList
.
Select
(
u
=>
u
.
FileName
).
ToArray
())
}
;"
);
_weiPanFileListRepository
.
BulkInsert
(
inserWeiPanFileList
.
ToArray
());
RedisHelper
.
Del
(
Constants
.
File_List_Tree
);
//清除缓存
RedisHelper
.
Del
(
Constants
.
First_File_List
);
//清除缓存
RedisHelper
.
Del
(
Constants
.
File_List_Tree
+
companyName
);
//清除缓存
RedisHelper
.
Del
(
Constants
.
First_File_List
+
companyName
);
//清除缓存
await
CreateUserFilesTreeRedis
(
companyName
);
}
...
...
@@ -798,7 +830,7 @@ namespace Bailun.Discuz.Application.WeiPan
//获取当前公司下所有部门
var
departmentItems
=
GetWechatDepartment
(
companyName
,
1
);
//对推送消息进行控制,减少调用次数
var
noIncludUsers
=
"陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼"
;
var
noIncludUsers
=
"陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼
,熊裕文,田壮虎,赵伟铭
"
;
UpdateCompanyName
();
var
userList
=
await
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
(!
noIncludUsers
.
Split
(
','
).
Contains
(
u
.
UserName
))
&&
u
.
CompanyName
==
companyName
).
ToListAsync
();
...
...
@@ -807,17 +839,15 @@ namespace Bailun.Discuz.Application.WeiPan
List
<
WeipanUserFiles
>
weipanUserFilesList
=
new
List
<
WeipanUserFiles
>();
//删除已经不存在的文件
var
notExitsFilelist
=
await
_weipanUserFilesRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
!
weiPanFileList
.
Select
(
s
=>
s
.
FileId
).
Contains
(
u
.
File_Id
)).
ToListAsync
();
var
notExitsFilelist
=
await
_weipanUserFilesRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
!
weiPanFileList
.
Select
(
s
=>
s
.
FileId
).
Contains
(
u
.
File_Id
)
&&
u
.
Company_Name
==
companyName
).
ToListAsync
();
if
(
notExitsFilelist
!=
null
)
{
notExitsFilelist
.
ForEach
(
u
=>
{
_weipanUserFilesRepository
.
Delete
(
u
.
Id
);
});
}
if
(
companyName
!=
"四千里数据科技有限公司"
)
{
await
ProcessWeipanUserFilesByHr
();
}
await
ProcessWeipanUserFilesByHr
(
companyName
,
weiPanFileList
);
//针对特殊用户的处理,不需要相关部门读取
foreach
(
var
weiPanFile
in
weiPanFileList
)
{
...
...
@@ -873,6 +903,7 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFiles
.
UserId
=
u
.
UserId
;
weipanUserFiles
.
FatherFileId
=
weiPanFile
.
FileId
;
weipanUserFiles
.
File_Id
=
weiPanFile
.
FileId
;
weipanUserFiles
.
Company_Name
=
companyName
;
weipanUserFilesList
.
Add
(
weipanUserFiles
);
}
}
...
...
@@ -897,30 +928,44 @@ namespace Bailun.Discuz.Application.WeiPan
return
null
;
}
public
async
Task
ProcessWeipanUserFilesByHr
()
public
async
Task
ProcessWeipanUserFilesByHr
(
string
companyName
,
List
<
WeiPanFileList
>
weiPanFileLists
)
{
var
includUsers
=
"陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼"
;
var
includUsers
=
"陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼
,熊裕文,田壮虎,赵伟铭
"
;
var
userList
=
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
(
includUsers
.
Split
(
','
).
Contains
(
u
.
UserName
))).
ToList
();
foreach
(
var
item
in
userList
)
{
if
(
item
.
UserId
!=
null
)
{
RedisHelper
.
HDel
(
Constants
.
File_List_Tree
,
item
.
UserId
);
RedisHelper
.
HDel
(
Constants
.
First_File_List
,
item
.
UserId
);
List
<
string
>
fileIds
=
new
List
<
string
>();
//获取用户对于的首层文件列表
var
firstFiles
=
await
GetFirstFileList
(
item
.
UserId
);
if
(
firstFiles
.
file_list
!=
null
)
{
weipanUserFileList
=
new
List
<
WeipanUserFiles
>();
await
_weipanUserFilesRepository
.
DeleteAsync
(
u
=>
u
.
UserId
==
item
.
UserId
);
foreach
(
var
file
in
firstFiles
.
file_list
.
item
)
var
weipanUserFileList
=
new
List
<
WeipanUserFiles
>();
if
(
weiPanFileLists
!=
null
)
{
await
GetFileListTree
(
item
.
UserId
,
file
.
fileid
,
false
);
weiPanFileLists
.
ForEach
(
u
=>
{
WeipanUserFiles
weipanUserFiles
=
new
WeipanUserFiles
();
weipanUserFiles
.
File_Id
=
u
.
FileId
;
weipanUserFiles
.
FatherFileId
=
u
.
FirstFileId
;
weipanUserFiles
.
Company_Name
=
companyName
;
weipanUserFiles
.
UserId
=
item
.
UserId
;
weipanUserFileList
.
Add
(
weipanUserFiles
);
});
}
await
_weipanUserFilesRepository
.
DeleteAsync
(
u
=>
u
.
UserId
==
item
.
UserId
&&
u
.
Company_Name
==
companyName
);
await
_weipanUserFilesRepository
.
BulkInsertAsync
(
weipanUserFileList
.
ToArray
());
}
#
region
旧逻辑
//List<string> fileIds = new List<string>();
////获取用户对于的首层文件列表
//var firstFiles = await GetFirstFileList(item.UserId, companyName,true,true);
//if (firstFiles.file_list != null)
//{
// weipanUserFileList = new List<WeipanUserFiles>();
// await _weipanUserFilesRepository.DeleteAsync(u => u.UserId == item.UserId);
// foreach (var file in firstFiles.file_list.item)
// {
// await GetFileListTree(item.UserId,companyName, file.fileid,false,true);
// }
// await _weipanUserFilesRepository.BulkInsertAsync(weipanUserFileList.ToArray());
//}
#
endregion
}
}
}
...
...
@@ -1059,10 +1104,10 @@ namespace Bailun.Discuz.Application.WeiPan
/// <param name="token"></param>
/// <param name="start"></param>
/// <returns></returns>
public
List
<
ItemItem
>
GetChildrensItem
(
string
userId
,
string
fatherid
,
string
token
,
int
start
,
string
firstFileId
,
string
firstFileName
)
public
List
<
ItemItem
>
GetChildrensItem
(
string
userId
,
string
fatherid
,
string
token
,
int
start
,
string
firstFileId
,
string
firstFileName
,
string
companyName
)
{
var
apiOutput
=
RequestFileList
(
userId
,
fatherid
,
start
,
token
);
var
apiOutput
=
RequestFileList
(
userId
,
fatherid
,
start
,
token
,
companyName
);
if
(
apiOutput
.
file_list
!=
null
)
{
var
files
=
apiOutput
.
file_list
.
item
;
...
...
@@ -1089,7 +1134,7 @@ namespace Bailun.Discuz.Application.WeiPan
foreach
(
var
item
in
nextItems
)
{
GetChildrensItem
(
userId
,
item
.
fileid
,
token
,
start
,
firstFileId
,
firstFileName
);
GetChildrensItem
(
userId
,
item
.
fileid
,
token
,
start
,
firstFileId
,
firstFileName
,
companyName
);
}
return
fileItems
;
}
...
...
@@ -1101,11 +1146,13 @@ namespace Bailun.Discuz.Application.WeiPan
List
<
WeiPanFileList
>
weiPanFileLists
=
new
List
<
WeiPanFileList
>();
List
<
ItemItem
>
itemItems
=
new
List
<
ItemItem
>();
var
token
=
GetQYWeChatToken
(
userId
);
var
firstFiles
=
await
GetFirstFileList
(
userId
,
false
);
var
firstFiles
=
await
GetFirstFileList
(
userId
,
companyName
,
false
);
if
(
firstFiles
.
file_list
!=
null
)
{
firstFiles
.
file_list
.
item
.
ForEach
(
u
=>
{
if
(!
u
.
file_name
.
Contains
(
"客户资料"
)&&
u
.
file_name
.
Contains
(
"商务流程"
))
{
u
.
firstfileid
=
u
.
fileid
;
u
.
firstFileName
=
u
.
file_name
;
if
(
u
.
file_type
==
2
&&
u
.
file_status
==
"1"
)
//说明是文件
...
...
@@ -1114,16 +1161,17 @@ namespace Bailun.Discuz.Application.WeiPan
}
else
{
if
(
companyName
==
"广州百伦供应链科技有限公司"
)
if
(
companyName
==
"广州百伦供应链科技有限公司"
)
{
if
(
u
.
create_userid
!=
"gaodesheng"
)
{
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
,
u
.
firstfileid
,
u
.
firstFile
Name
);
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
,
u
.
firstfileid
,
u
.
firstFileName
,
company
Name
);
}
}
else
{
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
,
u
.
firstfileid
,
u
.
firstFileName
);
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
,
u
.
firstfileid
,
u
.
firstFileName
,
companyName
);
}
}
}
});
...
...
src/Bailun.Discuz.Domain/WeiPan/WeipanUserFiles.cs
View file @
3d04a6da
...
...
@@ -15,5 +15,6 @@ namespace Bailun.Discuz.Domain.WeiPan
[
Column
(
"father_file_id"
)]
public
string
FatherFileId
{
get
;
set
;
}
[
Column
(
"file_id"
)]
public
string
File_Id
{
get
;
set
;
}
[
Column
(
"company_name"
)]
public
string
Company_Name
{
get
;
set
;
}
}
}
src/Bailun.Discuz.Service/Controllers/WeiPanController.cs
View file @
3d04a6da
...
...
@@ -45,9 +45,9 @@ namespace Bailun.Discuz.Service.Controllers
///// </summary>
///// <returns></returns>
[
HttpGet
(
"GetFirstFileList"
)]
public
async
Task
<
GetFileListResponse
>
GetFirstFileList
(
string
userId
)
public
async
Task
<
GetFileListResponse
>
GetFirstFileList
(
string
userId
,
string
companyName
)
{
return
await
_iweiPanService
.
GetFirstFileList
(
userId
);
return
await
_iweiPanService
.
GetFirstFileList
(
userId
,
companyName
,
true
);
}
///// <summary>
...
...
@@ -63,9 +63,9 @@ namespace Bailun.Discuz.Service.Controllers
/// 递归获取所有首页下的所有文件列表数据
/// </summary>
[
HttpGet
(
"GetFileListTree"
)]
public
async
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
fildId
)
public
async
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
fildId
,
string
companyName
)
{
return
await
_iweiPanService
.
GetFileListTree
(
userId
,
fildId
);
return
await
_iweiPanService
.
GetFileListTree
(
userId
,
companyName
,
fildId
);
}
/// <summary>
...
...
src/console/Bailun.Discuz.ConsoleApp.Publish/appsettings.Production.json
View file @
3d04a6da
...
...
@@ -17,6 +17,12 @@
"WeiPanSpaceId"
:
"s.ww833808f6b8dc0745.610693393XlV"
,
"WeiPanSpaceFileId"
:
"s.ww833808f6b8dc0745.610693393XlV_d.6106935069y7b"
},
"FourKQYWeChat"
:
{
"AppId"
:
"ww4e7dd5ae312eb101"
,
"Secret"
:
"tbiUloEtNcsbSnKRBpVjeWjlDTOR7pPAdOtmn3kfQMM "
,
"WeiPanSpaceId"
:
"s.ww4e7dd5ae312eb101.614679173dzT"
,
"WeiPanSpaceFileId"
:
"s.ww4e7dd5ae312eb101.614679173dzT_d.614679239rBH4"
},
"ApiServerUrl"
:
{
"ProductUrl"
:
"http://pro.bailuntec.com"
,
"ProfitApiAddress"
:
"http://profit.bailuntec.com"
,
...
...
@@ -43,5 +49,27 @@
"Host"
:
"10.0.0.2"
,
"UserName"
:
"bailun"
,
"Password"
:
"bailun2019"
},
"QiNiu"
:
{
"AccessKey"
:
"QSvtvN4Ons1CiNzaMGqx8XmDaiM1L0ZqSwJ2YoTn"
,
"SecretKey"
:
"yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm"
,
"CdnUrl"
:
"http://img.blsct.com"
,
"ProxyUrl"
:
"http://172.106.221.14:8513"
,
"ProductsCdnUrl"
:
"https://img.blsct.com"
,
"Bucket"
:
"bailun-publish-img"
,
"ImgCDNs"
:
[
"http://img.blsct.com"
,
"http://oyd60abh0.bkt.clouddn.com"
,
"http://elite99.blsct.com"
,
"http://bailun.blsct.com"
,
"http://gelnailpolish.blsct.com"
,
"http://nails.blsct.com"
,
"http://huilin.blsct.com"
,
"http://beauty.blsct.com"
,
"http://gelnails.blsct.com"
,
"http://digi.blsct.com"
,
"http://kiunobeauty.blsct.com"
,
"http://eumengman.blsct.com"
]
}
}
src/console/Bailun.Discuz.ConsoleApp.Publish/appsettings.json
View file @
3d04a6da
...
...
@@ -2,6 +2,12 @@
"ConnectionStrings"
:
{
"Discuz"
:
"Server=106.55.44.113;port=3306;database=discuz;uid=admin;password=e066d4d1;Convert Zero Datetime=True;Allow User Variables=True;pooling=true"
},
//
"redis"
:
{
//
"HostName"
:
"127.0.0.1"
,
//
"Port"
:
"6379"
,
//
"Password"
:
""
,
//
"Defaultdatabase"
:
1
//
},
"redis"
:
{
"HostName"
:
"10.0.8.8"
,
"Port"
:
"6379"
,
...
...
@@ -20,8 +26,8 @@
"FourKQYWeChat"
:
{
"AppId"
:
"ww4e7dd5ae312eb101"
,
"Secret"
:
"tbiUloEtNcsbSnKRBpVjeWjlDTOR7pPAdOtmn3kfQMM "
,
"WeiPanSpaceId"
:
"s.ww4e7dd5ae312eb101.614
410738dfa
"
,
"WeiPanSpaceFileId"
:
"s.ww4e7dd5ae312eb101.614
410738dfa_d.614411110Jd02
"
"WeiPanSpaceId"
:
"s.ww4e7dd5ae312eb101.614
679173dzT
"
,
"WeiPanSpaceFileId"
:
"s.ww4e7dd5ae312eb101.614
679173dzT_d.614679239rBH4
"
},
"ApiServerUrl"
:
{
"ProductUrl"
:
"http://pro.bailuntec.com"
,
...
...
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