Commit ae1169ab by xiongyuwen

no message

parent 668896ac
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; }
}
}
using Abp.Application.Services; using Abp.Application.Services;
using Abp.Domain.Services; using Abp.Domain.Services;
using Bailun.Discuz.Application.Account.Dto;
using Bailun.Discuz.Application.WeiPan.Dto.ResponseDto; using Bailun.Discuz.Application.WeiPan.Dto.ResponseDto;
using Bailun.Discuz.Domain.WeiPan; using Bailun.Discuz.Domain.WeiPan;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using static Bailun.Discuz.Application.WeiPan.Dto.Relationships.Relationships;
namespace Bailun.Discuz.Application.WeiPan namespace Bailun.Discuz.Application.WeiPan
{ {
...@@ -40,6 +42,8 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -40,6 +42,8 @@ namespace Bailun.Discuz.Application.WeiPan
/// </summary> /// </summary>
Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId); Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId);
Task<AttachmentsDto> GetAttchmattachmentByFileId(string fileId);
/// <summary> /// <summary>
/// 生成附件 /// 生成附件
/// </summary> /// </summary>
......
...@@ -27,6 +27,7 @@ using Bailun.Discuz.Application.Util; ...@@ -27,6 +27,7 @@ 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; using Users = Bailun.Discuz.Domain.WeiPan.Users;
using Bailun.Discuz.Application.Account.Dto;
namespace Bailun.Discuz.Application.WeiPan namespace Bailun.Discuz.Application.WeiPan
{ {
...@@ -463,6 +464,32 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -463,6 +464,32 @@ namespace Bailun.Discuz.Application.WeiPan
/// </summary> /// </summary>
/// <param name="md5"></param> /// <param name="md5"></param>
/// <returns></returns> /// <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) private async Task<WeiPanFileList> GetFileUrl(string md5)
{ {
return await _weiPanFileListRepository.Query().AsNoTracking().Where(u => u.FileMd5 == md5).FirstOrDefaultAsync(); return await _weiPanFileListRepository.Query().AsNoTracking().Where(u => u.FileMd5 == md5).FirstOrDefaultAsync();
...@@ -665,7 +692,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -665,7 +692,7 @@ namespace Bailun.Discuz.Application.WeiPan
data.relationships = new Dto.Relationships.Relationships(); data.relationships = new Dto.Relationships.Relationships();
data.relationships.attachments = new Dto.Relationships.Relationships.Attachments(); data.relationships.attachments = new Dto.Relationships.Relationships.Attachments();
data.relationships.attachments.data = new List<Dto.Relationships.Relationships.DataItem>(); 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 = new Dto.Relationships.Relationships.Category();
data.relationships.category.data = new Dto.Relationships.Relationships.Data(); data.relationships.category.data = new Dto.Relationships.Relationships.Data();
data.relationships.category.data.id = 2; data.relationships.category.data.id = 2;
...@@ -673,14 +700,14 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -673,14 +700,14 @@ namespace Bailun.Discuz.Application.WeiPan
data.type = "threads"; data.type = "threads";
data.attributes = new Dto.RequestDto.PublishTieZiRequest.Attributes(); data.attributes = new Dto.RequestDto.PublishTieZiRequest.Attributes();
data.attributes.type = 1; data.attributes.type = 1;
data.attributes.attachment_price =0; data.attributes.attachment_price = 0;
data.attributes.title = Path.GetFileNameWithoutExtension(weiPanFile.FileName); data.attributes.title = Path.GetFileNameWithoutExtension(weiPanFile.FileName);
data.attributes.content = Path.GetFileNameWithoutExtension(weiPanFile.FileName); data.attributes.content = Path.GetFileNameWithoutExtension(weiPanFile.FileName);
data.attributes.free_words=0 ; data.attributes.free_words = 0;
data.attributes.latitude =""; data.attributes.latitude = "";
data.attributes.longitude = ""; data.attributes.longitude = "";
data.attributes.location ="" ; data.attributes.location = "";
data.attributes.price =0 ; data.attributes.price = 0;
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));
...@@ -688,7 +715,6 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -688,7 +715,6 @@ namespace Bailun.Discuz.Application.WeiPan
var users = await GetNoticeUserNames(weiPanFile.FileId); var users = await GetNoticeUserNames(weiPanFile.FileId);
resultId = res.data.id; resultId = res.data.id;
PostNoticeByNewTieZi(users, resultId, token); PostNoticeByNewTieZi(users, resultId, token);
} }
return resultId; return resultId;
} }
......
using Bailun.AbpCore.ServiceFabric; using Bailun.AbpCore.ServiceFabric;
using Bailun.Discuz.Application.Account.Dto;
using Bailun.Discuz.Application.Util; using Bailun.Discuz.Application.Util;
using Bailun.Discuz.Application.WeiPan; using Bailun.Discuz.Application.WeiPan;
using Bailun.Discuz.Application.WeiPan.Dto.ResponseDto; using Bailun.Discuz.Application.WeiPan.Dto.ResponseDto;
...@@ -8,6 +9,7 @@ using System; ...@@ -8,6 +9,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using static Bailun.Discuz.Application.WeiPan.Dto.Relationships.Relationships;
namespace Bailun.Discuz.Service.Controllers namespace Bailun.Discuz.Service.Controllers
{ {
...@@ -94,5 +96,10 @@ namespace Bailun.Discuz.Service.Controllers ...@@ -94,5 +96,10 @@ namespace Bailun.Discuz.Service.Controllers
{ {
return await _iweiPanService.GetWeiPanFileByThreadId(threadId); return await _iweiPanService.GetWeiPanFileByThreadId(threadId);
} }
[HttpGet("GetAttchmattachmentByFileId")]
public async Task<AttachmentsDto> GetAttchmattachmentByFileId(string fileId)
{
return await _iweiPanService.GetAttchmattachmentByFileId(fileId);
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment