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
1efa49c7
Commit
1efa49c7
authored
Mar 01, 2021
by
xiongyuwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
e102ab02
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
277 additions
and
37 deletions
+277
-37
Constants.cs
src/Bailun.Discuz.Application/Util/Constants.cs
+0
-3
GetFileListResponse.cs
...Application/WeiPan/Dto/ResponseDto/GetFileListResponse.cs
+1
-1
GetWeChatUserInfoResponse.cs
...ation/WeiPan/Dto/ResponseDto/GetWeChatUserInfoResponse.cs
+42
-0
GetWechatDepartmentResponse.cs
...ion/WeiPan/Dto/ResponseDto/GetWechatDepartmentResponse.cs
+46
-0
WeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
+187
-32
WeiPanFileList.cs
src/Bailun.Discuz.Domain/WeiPan/WeiPanFileList.cs
+1
-1
No files found.
src/Bailun.Discuz.Application/Util/Constants.cs
View file @
1efa49c7
...
@@ -10,8 +10,5 @@ namespace Bailun.Discuz.Application.Util
...
@@ -10,8 +10,5 @@ namespace Bailun.Discuz.Application.Util
public
const
string
File_List_Tree
=
"FileListTree"
;
public
const
string
File_List_Tree
=
"FileListTree"
;
public
const
string
ForuK_First_File_List
=
"FirstFileList"
;
public
const
string
ForuK_File_List_Tree
=
"FileListTree"
;
}
}
}
}
src/Bailun.Discuz.Application/WeiPan/Dto/ResponseDto/GetFileListResponse.cs
View file @
1efa49c7
...
@@ -6,7 +6,7 @@ namespace Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
...
@@ -6,7 +6,7 @@ namespace Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
{
{
public
class
ItemItem
public
class
ItemItem
{
{
public
string
firstFileName
{
get
;
set
;
}
public
string
firstfileid
{
get
;
set
;
}
public
string
firstfileid
{
get
;
set
;
}
/// <summary>
/// <summary>
///
///
...
...
src/Bailun.Discuz.Application/WeiPan/Dto/ResponseDto/GetWeChatUserInfoResponse.cs
0 → 100644
View file @
1efa49c7
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
{
public
class
UserlistItem
{
/// <summary>
///
/// </summary>
public
string
userid
{
get
;
set
;
}
/// <summary>
/// 张三
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
List
<
int
>
department
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
open_userid
{
get
;
set
;
}
}
public
class
GetWeChatUserInfoResponse
{
/// <summary>
///
/// </summary>
public
int
errcode
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
errmsg
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
List
<
UserlistItem
>
userlist
{
get
;
set
;
}
}
}
src/Bailun.Discuz.Application/WeiPan/Dto/ResponseDto/GetWechatDepartmentResponse.cs
0 → 100644
View file @
1efa49c7
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
{
public
class
DepartmentItem
{
/// <summary>
///
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 部门名称:如 广州研发中心
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
name_en
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
parentid
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
order
{
get
;
set
;
}
}
public
class
GetWechatDepartmentResponse
{
/// <summary>
///
/// </summary>
public
int
errcode
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
errmsg
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
List
<
DepartmentItem
>
department
{
get
;
set
;
}
}
}
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
View file @
1efa49c7
...
@@ -546,6 +546,10 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -546,6 +546,10 @@ namespace Bailun.Discuz.Application.WeiPan
{
{
var
oaUserId
=
oaUserIds
[
0
].
userId
;
var
oaUserId
=
oaUserIds
[
0
].
userId
;
companyName
=
GetDeparmentIdByUserId
(
oaUserId
);
companyName
=
GetDeparmentIdByUserId
(
oaUserId
);
if
(
companyName
!=
"广州百伦供应链科技有限公司"
||
companyName
!=
"四千里数据科技有限公司"
)
{
companyName
=
"广州百伦供应链科技有限公司"
;
}
//更新到用户表中
//更新到用户表中
user
.
CompanyName
=
companyName
;
user
.
CompanyName
=
companyName
;
_usersRepository
.
UpdateCommit
(
user
);
_usersRepository
.
UpdateCommit
(
user
);
...
@@ -586,15 +590,28 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -586,15 +590,28 @@ namespace Bailun.Discuz.Application.WeiPan
}
}
}
}
public
void
UpdateCompanyName
()
{
var
userList
=
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
UserId
!=
null
&&(
u
.
CompanyName
==
null
||
u
.
CompanyName
==
""
)).
ToList
();
if
(
userList
!=
null
)
{
userList
.
ForEach
(
u
=>
{
GetCompanyName
(
u
.
UserId
);
});
}
}
private
string
GetQYWeChatToken
(
string
userId
)
private
string
GetQYWeChatToken
(
string
userId
,
string
companyName
=
null
)
{
{
//四千里数据科技有限公司
//四千里数据科技有限公司
//广州百伦供应链科技有限公司
//广州百伦供应链科技有限公司
//获取用户id对应得部门
//获取用户id对应得部门
var
appId
=
""
;
var
appId
=
""
;
var
secret
=
""
;
var
secret
=
""
;
string
companyName
=
GetCompanyName
(
userId
);
if
(
companyName
.
IsNullOrEmpty
())
{
companyName
=
GetCompanyName
(
userId
);
}
if
(
companyName
==
"广州百伦供应链科技有限公司"
)
if
(
companyName
==
"广州百伦供应链科技有限公司"
)
{
{
appId
=
ConfigManagerConf
.
GetValue
(
"QYWeChat:AppId"
);
appId
=
ConfigManagerConf
.
GetValue
(
"QYWeChat:AppId"
);
...
@@ -632,15 +649,15 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -632,15 +649,15 @@ namespace Bailun.Discuz.Application.WeiPan
public
async
Task
<
string
>
ProcessWeiPanWorker
(
string
userId
,
string
companyName
)
public
async
Task
<
string
>
ProcessWeiPanWorker
(
string
userId
,
string
companyName
)
{
{
StringBuilder
messageSb
=
new
StringBuilder
();
;
StringBuilder
messageSb
=
new
StringBuilder
();
// string userId = "chenzekai";
// string userId = "chenzekai";
List
<
WeiPanFileList
>
inserWeiPanFileList
=
new
List
<
WeiPanFileList
>();
List
<
WeiPanFileList
>
inserWeiPanFileList
=
new
List
<
WeiPanFileList
>();
//1:获取线上的所有文档数据
//1:获取线上的所有文档数据
var
filList
=
await
GetFileList
(
userId
,
companyName
);
var
filList
=
await
GetFileList
(
userId
,
companyName
);
//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
)
...
@@ -702,11 +719,12 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -702,11 +719,12 @@ namespace Bailun.Discuz.Application.WeiPan
if
(
inserWeiPanFileList
.
Count
>
0
||
delFiles
.
Any
())
//有新增则清除缓存
if
(
inserWeiPanFileList
.
Count
>
0
||
delFiles
.
Any
())
//有新增则清除缓存
{
{
messageSb
.
Append
(
$"新增帖子数量为:
{
inserWeiPanFileList
.
Count
}
,分别为:
{
string
.
Join
(
","
,
inserWeiPanFileList
.
Select
(
u
=>
u
.
FileName
).
ToArray
())
}
;"
);
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.File_List_Tree);//清除缓存
//RedisHelper.Del(Constants.First_File_List);//清除缓存
//RedisHelper.Del(Constants.First_File_List);//清除缓存
await
CreateUserFilesTreeRedis
(
companyName
);
await
CreateUserFilesTreeRedis
(
companyName
);
}
}
_weiPanFileListRepository
.
BulkInsert
(
inserWeiPanFileList
.
ToArray
());
var
noTieZilist
=
await
_weiPanFileListRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
ThreadId
==
0
&&
u
.
CompanyName
==
companyName
).
ToListAsync
();
var
noTieZilist
=
await
_weiPanFileListRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
ThreadId
==
0
&&
u
.
CompanyName
==
companyName
).
ToListAsync
();
foreach
(
var
item
in
noTieZilist
)
foreach
(
var
item
in
noTieZilist
)
{
{
...
@@ -747,15 +765,109 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -747,15 +765,109 @@ namespace Bailun.Discuz.Application.WeiPan
/// <returns></returns>
/// <returns></returns>
public
async
Task
<
string
>
CreateUserFilesTreeRedis
(
string
companyName
)
public
async
Task
<
string
>
CreateUserFilesTreeRedis
(
string
companyName
)
{
{
//获取当前公司下所有部门
var
departmentItems
=
GetWechatDepartment
(
companyName
,
1
);
//对推送消息进行控制,减少调用次数
//对推送消息进行控制,减少调用次数
var
includUsers
=
"陈泽凯,田壮虎,付典,陈琦,钟晓桐,张仲杰,冯晓茵,高得胜,李可欣,黎慧琼,赵伟铭"
;
var
noIncludUsers
=
"陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼"
;
UpdateCompanyName
();
var
userList
=
await
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
(!
noIncludUsers
.
Split
(
','
).
Contains
(
u
.
UserName
))
&&
u
.
CompanyName
==
companyName
).
ToListAsync
();
//遍历所有文件,根据首页文件夹名称获取对应得用户
var
weiPanFileList
=
await
_weiPanFileListRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
CompanyName
==
companyName
).
ToListAsync
();
List
<
WeipanUserFiles
>
weipanUserFilesList
=
new
List
<
WeipanUserFiles
>();
//删除已经不存在的文件
var
notExitsFilelist
=
await
_weipanUserFilesRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
!
weiPanFileList
.
Select
(
s
=>
s
.
FileId
).
Contains
(
u
.
File_Id
)).
ToListAsync
();
if
(
notExitsFilelist
!=
null
)
{
notExitsFilelist
.
ForEach
(
u
=>
{
_weipanUserFilesRepository
.
Delete
(
u
.
Id
);
});
}
//await ProcessWeipanUserFilesByHr();
foreach
(
var
weiPanFile
in
weiPanFileList
)
{
var
oldWeipanUserFiles
=
await
_weipanUserFilesRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
File_Id
==
weiPanFile
.
FileId
).
ToListAsync
();
var
firstFileName
=
weiPanFile
.
FirstFileName
;
var
selDepartments
=
firstFileName
.
Split
(
'-'
).
ToList
();
var
departmentItem
=
departmentItems
.
Where
(
d
=>
d
.
name
==
selDepartments
[
0
]).
FirstOrDefault
();
if
(
departmentItem
!=
null
)
{
if
(
departmentItems
.
Count
>
1
)
{
var
secondDepartments
=
GetWechatDepartment
(
companyName
,
departmentItem
.
id
);
departmentItem
=
secondDepartments
.
Where
(
d
=>
d
.
name
==
firstFileName
.
Split
(
'-'
)[
1
]).
FirstOrDefault
();
}
}
if
(
departmentItem
!=
null
||
selDepartments
[
0
]==
"公司制度及资讯"
)
{
if
(
selDepartments
[
0
]
==
"公司制度及资讯"
)
{
}
//根据部门获取对应得用户列表数据
var
weChatUserList
=
GetWechatUserInfo
(
companyName
,
selDepartments
[
0
]
==
"公司制度及资讯"
?
1
:
departmentItem
.
id
).
ToList
();
if
(
weChatUserList
!=
null
)
{
if
(
weChatUserList
.
Count
>
0
)
{
var
tmpUserList
=
userList
.
Where
(
u
=>
weChatUserList
.
Select
(
s
=>
s
.
userid
).
Contains
(
u
.
UserId
)).
ToList
();
var
notExitsUser
=
oldWeipanUserFiles
.
Where
(
u
=>
!
weChatUserList
.
Select
(
s
=>
s
.
userid
).
Contains
(
u
.
UserId
)).
ToList
();
notExitsUser
.
ForEach
(
u
=>
{
if
(
tmpUserList
.
Where
(
s
=>
s
.
UserId
==
u
.
UserId
).
FirstOrDefault
()!=
null
)
{
_weipanUserFilesRepository
.
Delete
(
u
.
Id
);
}
});
tmpUserList
.
ForEach
(
u
=>
{
if
(
oldWeipanUserFiles
.
Where
(
f
=>
f
.
UserId
==
u
.
UserId
).
FirstOrDefault
()==
null
)
{
WeipanUserFiles
weipanUserFiles
=
new
WeipanUserFiles
();
weipanUserFiles
.
UserId
=
u
.
UserId
;
weipanUserFiles
.
FatherFileId
=
weiPanFile
.
FileId
;
weipanUserFiles
.
File_Id
=
weiPanFile
.
FileId
;
weipanUserFilesList
.
Add
(
weipanUserFiles
);
}
}
);
}
}
}
}
if
(
weipanUserFilesList
!=
null
&&
weipanUserFilesList
.
Count
>
0
)
{
var
tmpUserIds
=
weipanUserFilesList
.
GroupBy
(
u
=>
u
.
UserId
).
ToList
();
tmpUserIds
.
ForEach
(
u
=>
{
RedisHelper
.
HDel
(
Constants
.
File_List_Tree
,
u
.
Key
);
RedisHelper
.
HDel
(
Constants
.
First_File_List
,
u
.
Key
);
});
await
_weipanUserFilesRepository
.
BulkInsertAsync
(
weipanUserFilesList
.
ToArray
());
}
// var userList = await _usersRepository.Query().AsNoTracking().Where(u=>(includUsers.Split(',').Contains(u.UserName)|| u.LoginAt>=(DateTime.Now.AddDays(-8).Date))&&u.CompanyName==companyName).ToListAsync();
return
null
;
}
public
async
Task
ProcessWeipanUserFilesByHr
()
{
var
includUsers
=
"陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼"
;
var
userList
=
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
(
includUsers
.
Split
(
','
).
Contains
(
u
.
UserName
))).
ToList
();
var
userList
=
await
_usersRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>(
includUsers
.
Split
(
','
).
Contains
(
u
.
UserName
)||
u
.
LoginAt
>=(
DateTime
.
Now
.
AddDays
(-
8
).
Date
))&&
u
.
CompanyName
==
companyName
).
ToListAsync
();
foreach
(
var
item
in
userList
)
foreach
(
var
item
in
userList
)
{
{
if
(
item
.
UserId
!=
null
)
if
(
item
.
UserId
!=
null
)
{
{
RedisHelper
.
HDel
(
Constants
.
File_List_Tree
,
item
.
UserId
);
RedisHelper
.
HDel
(
Constants
.
File_List_Tree
,
item
.
UserId
);
RedisHelper
.
HDel
(
Constants
.
First_File_List
,
item
.
UserId
);
RedisHelper
.
HDel
(
Constants
.
First_File_List
,
item
.
UserId
);
List
<
string
>
fileIds
=
new
List
<
string
>();
List
<
string
>
fileIds
=
new
List
<
string
>();
//获取用户对于的首层文件列表
//获取用户对于的首层文件列表
...
@@ -766,13 +878,12 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -766,13 +878,12 @@ namespace Bailun.Discuz.Application.WeiPan
await
_weipanUserFilesRepository
.
DeleteAsync
(
u
=>
u
.
UserId
==
item
.
UserId
);
await
_weipanUserFilesRepository
.
DeleteAsync
(
u
=>
u
.
UserId
==
item
.
UserId
);
foreach
(
var
file
in
firstFiles
.
file_list
.
item
)
foreach
(
var
file
in
firstFiles
.
file_list
.
item
)
{
{
await
GetFileListTree
(
item
.
UserId
,
file
.
fileid
,
false
);
await
GetFileListTree
(
item
.
UserId
,
file
.
fileid
,
false
);
}
}
await
_weipanUserFilesRepository
.
BulkInsertAsync
(
weipanUserFileList
.
ToArray
());
await
_weipanUserFilesRepository
.
BulkInsertAsync
(
weipanUserFileList
.
ToArray
());
}
}
}
}
}
}
return
null
;
}
}
public
async
Task
<
List
<
string
>>
GetNoticeUserNames
(
string
fileId
,
string
fileCreateUseid
)
public
async
Task
<
List
<
string
>>
GetNoticeUserNames
(
string
fileId
,
string
fileCreateUseid
)
...
@@ -792,6 +903,37 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -792,6 +903,37 @@ namespace Bailun.Discuz.Application.WeiPan
}
}
return
result
;
return
result
;
}
}
public
List
<
DepartmentItem
>
GetWechatDepartment
(
string
companyName
,
int
id
)
{
//获取token
var
token
=
GetQYWeChatToken
(
companyName
);
var
response
=
HttpHelper
.
HttpGet
(
$"https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=
{
token
}
&id=
{
id
}
"
);
var
result
=
JsonHelper
.
FromJson
<
GetWechatDepartmentResponse
>(
response
);
if
(
result
.
errcode
!=
0
)
{
throw
new
Exception
(
"获取部门列表信息失败:"
+
result
.
errmsg
);
}
else
{
return
result
.
department
;
}
}
public
List
<
UserlistItem
>
GetWechatUserInfo
(
string
companyName
,
int
departmentId
)
{
//获取token
var
token
=
GetQYWeChatToken
(
companyName
);
var
response
=
HttpHelper
.
HttpGet
(
$"https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?access_token=
{
token
}
&department_id=
{
departmentId
}
&fetch_child=1"
);
var
result
=
JsonHelper
.
FromJson
<
GetWeChatUserInfoResponse
>(
response
);
if
(
result
.
errcode
!=
0
)
{
throw
new
Exception
(
"获取根据部门获取用户信息失败:"
+
result
.
errmsg
);
}
else
{
return
result
.
userlist
;
}
}
public
async
Task
<
string
>
PublishTieZi
(
WeiPanFileList
weiPanFile
)
public
async
Task
<
string
>
PublishTieZi
(
WeiPanFileList
weiPanFile
)
{
{
string
resultId
=
""
;
string
resultId
=
""
;
...
@@ -867,7 +1009,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -867,7 +1009,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
,
string
firstFileId
)
public
List
<
ItemItem
>
GetChildrensItem
(
string
userId
,
string
fatherid
,
string
token
,
int
start
,
string
firstFileId
,
string
firstFileName
)
{
{
var
apiOutput
=
RequestFileList
(
userId
,
fatherid
,
start
,
token
);
var
apiOutput
=
RequestFileList
(
userId
,
fatherid
,
start
,
token
);
...
@@ -881,6 +1023,7 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -881,6 +1023,7 @@ namespace Bailun.Discuz.Application.WeiPan
if
(
i
.
file_type
==
2
&&
i
.
file_status
==
"1"
)
if
(
i
.
file_type
==
2
&&
i
.
file_status
==
"1"
)
{
{
i
.
firstfileid
=
firstFileId
;
i
.
firstfileid
=
firstFileId
;
i
.
firstFileName
=
firstFileName
;
fileItems
.
Add
(
i
);
fileItems
.
Add
(
i
);
}
}
...
@@ -896,48 +1039,60 @@ namespace Bailun.Discuz.Application.WeiPan
...
@@ -896,48 +1039,60 @@ namespace Bailun.Discuz.Application.WeiPan
foreach
(
var
item
in
nextItems
)
foreach
(
var
item
in
nextItems
)
{
{
GetChildrensItem
(
userId
,
item
.
fileid
,
token
,
start
,
firstFileId
);
GetChildrensItem
(
userId
,
item
.
fileid
,
token
,
start
,
firstFileId
,
firstFileName
);
}
}
return
fileItems
;
return
fileItems
;
}
}
/// <summary>
/// <summary>
/// 递归获取所有首页下的所有文件列表数据
/// 递归获取所有首页下的所有文件列表数据
/// </summary>
/// </summary>
public
async
Task
<
List
<
WeiPanFileList
>>
GetFileList
(
string
userId
,
string
companyName
)
public
async
Task
<
List
<
WeiPanFileList
>>
GetFileList
(
string
userId
,
string
companyName
)
{
{
List
<
WeiPanFileList
>
weiPanFileLists
=
new
List
<
WeiPanFileList
>();
List
<
WeiPanFileList
>
weiPanFileLists
=
new
List
<
WeiPanFileList
>();
List
<
ItemItem
>
itemItems
=
new
List
<
ItemItem
>();
List
<
ItemItem
>
itemItems
=
new
List
<
ItemItem
>();
var
token
=
GetQYWeChatToken
(
userId
);
var
token
=
GetQYWeChatToken
(
userId
);
var
firstFiles
=
await
GetFirstFileList
(
userId
,
false
);
var
firstFiles
=
await
GetFirstFileList
(
userId
,
false
);
if
(
firstFiles
.
file_list
!=
null
)
if
(
firstFiles
.
file_list
!=
null
)
{
{
firstFiles
.
file_list
.
item
.
ForEach
(
u
=>
firstFiles
.
file_list
.
item
.
ForEach
(
u
=>
{
{
u
.
firstfileid
=
u
.
fileid
;
u
.
firstfileid
=
u
.
fileid
;
if
(
u
.
file_type
==
2
&&
u
.
file_status
==
"1"
)
//说明是文件
u
.
firstFileName
=
u
.
file_name
;
if
(
u
.
file_type
==
2
&&
u
.
file_status
==
"1"
)
//说明是文件
{
{
itemItems
.
Add
(
u
);
itemItems
.
Add
(
u
);
}
}
else
else
{
{
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
,
u
.
firstfileid
);
if
(
companyName
==
"广州百伦供应链科技有限公司"
)
{
if
(
u
.
create_userid
!=
"gaodesheng"
)
{
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
,
u
.
firstfileid
,
u
.
firstFileName
);
}
}
else
{
GetChildrensItem
(
userId
,
u
.
fileid
,
token
,
0
,
u
.
firstfileid
,
u
.
firstFileName
);
}
}
}
});
});
}
}
itemItems
.
AddRange
(
fileItems
);
itemItems
.
AddRange
(
fileItems
);
itemItems
.
ForEach
(
u
=>
{
itemItems
.
ForEach
(
u
=>
WeiPanFileList
weiPanFile
=
new
WeiPanFileList
();
{
weiPanFile
.
CreateTime
=
DateTime
.
Now
;
WeiPanFileList
weiPanFile
=
new
WeiPanFileList
();
weiPanFile
.
FileId
=
u
.
fileid
;
weiPanFile
.
CreateTime
=
DateTime
.
Now
;
weiPanFile
.
FileMd5
=
u
.
md5
;
weiPanFile
.
FileId
=
u
.
fileid
;
weiPanFile
.
FileName
=
u
.
file_name
;
weiPanFile
.
FileMd5
=
u
.
md5
;
weiPanFile
.
CompanyName
=
companyName
;
weiPanFile
.
FileName
=
u
.
file_name
;
weiPanFile
.
FirstFileId
=
u
.
firstfileid
;
weiPanFile
.
CompanyName
=
companyName
;
weiPanFile
.
QiniuUrl
=
""
;
weiPanFile
.
FirstFileId
=
u
.
firstfileid
;
weiPanFile
.
FileCreateUseid
=
u
.
create_userid
;
weiPanFile
.
QiniuUrl
=
""
;
weiPanFileLists
.
Add
(
weiPanFile
);
weiPanFile
.
FileCreateUseid
=
u
.
create_userid
;
});
weiPanFile
.
FirstFileName
=
u
.
firstFileName
;
weiPanFileLists
.
Add
(
weiPanFile
);
});
return
weiPanFileLists
;
return
weiPanFileLists
;
}
}
}
}
...
...
src/Bailun.Discuz.Domain/WeiPan/WeiPanFileList.cs
View file @
1efa49c7
...
@@ -24,6 +24,6 @@ namespace Bailun.Discuz.Domain.WeiPan
...
@@ -24,6 +24,6 @@ namespace Bailun.Discuz.Domain.WeiPan
[
Column
(
"first_file_id"
)]
public
string
FirstFileId
{
get
;
set
;
}
[
Column
(
"first_file_id"
)]
public
string
FirstFileId
{
get
;
set
;
}
[
Column
(
"file_create_useid"
)]
public
string
FileCreateUseid
{
get
;
set
;
}
[
Column
(
"file_create_useid"
)]
public
string
FileCreateUseid
{
get
;
set
;
}
[
Column
(
"company_name"
)]
public
string
CompanyName
{
get
;
set
;
}
[
Column
(
"company_name"
)]
public
string
CompanyName
{
get
;
set
;
}
[
Column
(
"first_file_name"
)]
public
string
FirstFileName
{
get
;
set
;
}
}
}
}
}
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