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
ae1169ab
Commit
ae1169ab
authored
Jan 25, 2021
by
xiongyuwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
668896ac
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
8 deletions
+79
-8
AttachmentsDto.cs
src/Bailun.Discuz.Application/Account/Dto/AttachmentsDto.cs
+34
-0
IWeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/IWeiPanService.cs
+4
-0
WeiPanService.cs
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
+34
-8
WeiPanController.cs
src/Bailun.Discuz.Service/Controllers/WeiPanController.cs
+7
-0
No files found.
src/Bailun.Discuz.Application/Account/Dto/AttachmentsDto.cs
0 → 100644
View file @
ae1169ab
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.Discuz.Application.Account.Dto
{
public
class
AttachmentsDto
{
public
string
attachment
{
get
;
set
;
}
public
string
extension
{
get
;
set
;
}
public
string
fileName
{
get
;
set
;
}
public
string
filePath
{
get
;
set
;
}
public
int
fileSize
{
get
;
set
;
}
public
string
fileType
{
get
;
set
;
}
public
long
id
{
get
;
set
;
}
public
int
isApproved
{
get
;
set
;
}
public
bool
isRemote
{
get
;
set
;
}
public
int
order
{
get
;
set
;
}
public
string
thumbUrl
{
get
;
set
;
}
public
int
type
{
get
;
set
;
}
public
string
type_id
{
get
;
set
;
}
public
string
url
{
get
;
set
;
}
}
}
src/Bailun.Discuz.Application/WeiPan/IWeiPanService.cs
View file @
ae1169ab
using
Abp.Application.Services
;
using
Abp.Domain.Services
;
using
Bailun.Discuz.Application.Account.Dto
;
using
Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
;
using
Bailun.Discuz.Domain.WeiPan
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading.Tasks
;
using
static
Bailun
.
Discuz
.
Application
.
WeiPan
.
Dto
.
Relationships
.
Relationships
;
namespace
Bailun.Discuz.Application.WeiPan
{
...
...
@@ -40,6 +42,8 @@ namespace Bailun.Discuz.Application.WeiPan
/// </summary>
Task
<
List
<
FileListTreeDto
>>
GetFileListTree
(
string
userId
,
string
fildId
);
Task
<
AttachmentsDto
>
GetAttchmattachmentByFileId
(
string
fileId
);
/// <summary>
/// 生成附件
/// </summary>
...
...
src/Bailun.Discuz.Application/WeiPan/WeiPanService.cs
View file @
ae1169ab
...
...
@@ -27,6 +27,7 @@ using Bailun.Discuz.Application.Util;
using
Abp.Domain.Uow
;
using
Abp.Domain.Services
;
using
Users
=
Bailun
.
Discuz
.
Domain
.
WeiPan
.
Users
;
using
Bailun.Discuz.Application.Account.Dto
;
namespace
Bailun.Discuz.Application.WeiPan
{
...
...
@@ -463,6 +464,32 @@ namespace Bailun.Discuz.Application.WeiPan
/// </summary>
/// <param name="md5"></param>
/// <returns></returns>
public
async
Task
<
AttachmentsDto
>
GetAttchmattachmentByFileId
(
string
fileId
)
{
var
attchment
=
await
_attachmentsRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
Uuid
==
fileId
).
FirstOrDefaultAsync
();
AttachmentsDto
attachmentsDto
=
new
AttachmentsDto
();
attachmentsDto
.
attachment
=
attchment
.
Attachment
;
attachmentsDto
.
extension
=
Path
.
GetExtension
(
attchment
.
Attachment
);
attachmentsDto
.
fileName
=
attchment
.
Attachment
;
attachmentsDto
.
filePath
=
attchment
.
Attachment
;
attachmentsDto
.
fileSize
=
0
;
attachmentsDto
.
fileType
=
attchment
.
FileType
;
attachmentsDto
.
id
=
attchment
.
Id
;
attachmentsDto
.
isApproved
=
1
;
attachmentsDto
.
isRemote
=
false
;
attachmentsDto
.
order
=
0
;
attachmentsDto
.
thumbUrl
=
attchment
.
FilePath
;
attachmentsDto
.
type
=
0
;
attachmentsDto
.
type_id
=
attchment
.
FilePath
;
attachmentsDto
.
url
=
attchment
.
FilePath
;
return
attachmentsDto
;
}
/// <summary>
/// 从数据库中获取对应得文件地址
/// </summary>
/// <param name="md5"></param>
/// <returns></returns>
private
async
Task
<
WeiPanFileList
>
GetFileUrl
(
string
md5
)
{
return
await
_weiPanFileListRepository
.
Query
().
AsNoTracking
().
Where
(
u
=>
u
.
FileMd5
==
md5
).
FirstOrDefaultAsync
();
...
...
@@ -665,7 +692,7 @@ namespace Bailun.Discuz.Application.WeiPan
data
.
relationships
=
new
Dto
.
Relationships
.
Relationships
();
data
.
relationships
.
attachments
=
new
Dto
.
Relationships
.
Relationships
.
Attachments
();
data
.
relationships
.
attachments
.
data
=
new
List
<
Dto
.
Relationships
.
Relationships
.
DataItem
>();
data
.
relationships
.
attachments
.
data
.
Add
(
new
Dto
.
Relationships
.
Relationships
.
DataItem
{
id
=
attachmentid
,
type
=
"attachments"
});
data
.
relationships
.
attachments
.
data
.
Add
(
new
Dto
.
Relationships
.
Relationships
.
DataItem
{
id
=
attachmentid
,
type
=
"attachments"
});
data
.
relationships
.
category
=
new
Dto
.
Relationships
.
Relationships
.
Category
();
data
.
relationships
.
category
.
data
=
new
Dto
.
Relationships
.
Relationships
.
Data
();
data
.
relationships
.
category
.
data
.
id
=
2
;
...
...
@@ -673,14 +700,14 @@ namespace Bailun.Discuz.Application.WeiPan
data
.
type
=
"threads"
;
data
.
attributes
=
new
Dto
.
RequestDto
.
PublishTieZiRequest
.
Attributes
();
data
.
attributes
.
type
=
1
;
data
.
attributes
.
attachment_price
=
0
;
data
.
attributes
.
title
=
Path
.
GetFileNameWithoutExtension
(
weiPanFile
.
FileName
);
data
.
attributes
.
attachment_price
=
0
;
data
.
attributes
.
title
=
Path
.
GetFileNameWithoutExtension
(
weiPanFile
.
FileName
);
data
.
attributes
.
content
=
Path
.
GetFileNameWithoutExtension
(
weiPanFile
.
FileName
);
data
.
attributes
.
free_words
=
0
;
data
.
attributes
.
latitude
=
""
;
data
.
attributes
.
free_words
=
0
;
data
.
attributes
.
latitude
=
""
;
data
.
attributes
.
longitude
=
""
;
data
.
attributes
.
location
=
""
;
data
.
attributes
.
price
=
0
;
data
.
attributes
.
location
=
""
;
data
.
attributes
.
price
=
0
;
publishTieZiRequest
.
data
=
data
;
var
apiUrl
=
$"http://discuz.bailuntec.com/api/threads"
;
var
res
=
JsonHelper
.
ToObject
<
PublishTieZiResponse
>(
Client_Post
(
publishTieZiRequest
.
ToJson
(),
apiUrl
,
"Bearer "
+
token
));
...
...
@@ -688,7 +715,6 @@ namespace Bailun.Discuz.Application.WeiPan
var
users
=
await
GetNoticeUserNames
(
weiPanFile
.
FileId
);
resultId
=
res
.
data
.
id
;
PostNoticeByNewTieZi
(
users
,
resultId
,
token
);
}
return
resultId
;
}
...
...
src/Bailun.Discuz.Service/Controllers/WeiPanController.cs
View file @
ae1169ab
using
Bailun.AbpCore.ServiceFabric
;
using
Bailun.Discuz.Application.Account.Dto
;
using
Bailun.Discuz.Application.Util
;
using
Bailun.Discuz.Application.WeiPan
;
using
Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
;
...
...
@@ -8,6 +9,7 @@ using System;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
static
Bailun
.
Discuz
.
Application
.
WeiPan
.
Dto
.
Relationships
.
Relationships
;
namespace
Bailun.Discuz.Service.Controllers
{
...
...
@@ -94,5 +96,10 @@ namespace Bailun.Discuz.Service.Controllers
{
return
await
_iweiPanService
.
GetWeiPanFileByThreadId
(
threadId
);
}
[
HttpGet
(
"GetAttchmattachmentByFileId"
)]
public
async
Task
<
AttachmentsDto
>
GetAttchmattachmentByFileId
(
string
fileId
)
{
return
await
_iweiPanService
.
GetAttchmattachmentByFileId
(
fileId
);
}
}
}
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