v 1.1.4 新增文件上传中转 七牛云
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LMS.Repository.DB;
|
||||
|
||||
public class FileUploads
|
||||
{
|
||||
[Key]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
public long UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
public string FileName { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(500)]
|
||||
public string FileKey { get; set; }
|
||||
|
||||
public long FileSize { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string ContentType { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string Hash { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(1000)]
|
||||
public string QiniuUrl { get; set; }
|
||||
|
||||
public DateTime UploadTime { get; set; }
|
||||
|
||||
[StringLength(20)]
|
||||
public string Status { get; set; } = "active";
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除时间 ,默认为最大值,表示未删除
|
||||
/// </summary>
|
||||
public DateTime DeleteTime { get; set; } = DateTime.MaxValue;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using LMS.Repository.DB;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LMS.Repository.DTO
|
||||
{
|
||||
public class FileUploadDto
|
||||
{
|
||||
public class ByteUploadRequest
|
||||
{
|
||||
//public required string FileBytes { get; set; }
|
||||
/// <summary>
|
||||
/// 文件的base64
|
||||
/// </summary>
|
||||
public required string File { get; set; }
|
||||
public required string FileName { get; set; }
|
||||
public required string ContentType { get; set; }
|
||||
public Dictionary<string, string> Metadata { get; set; } = new();
|
||||
}
|
||||
|
||||
public class UploadResult
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string FileKey { get; set; }
|
||||
public string Hash { get; set; }
|
||||
public long FileId { get; set; }
|
||||
public long FileSize { get; set; }
|
||||
}
|
||||
|
||||
public class FileListResponse
|
||||
{
|
||||
public List<FileUploads> Files { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
public int Page { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace LMS.Repository.FileUpload
|
||||
{
|
||||
public class FileRequestReturn
|
||||
{
|
||||
public class FileMachineRequestReturn
|
||||
{
|
||||
public string MachineId { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public long FileSize { get; set; }
|
||||
public string ContentType { get; set; }
|
||||
|
||||
public string Hash { get; set; }
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
public DateTime UploadTime { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
/// <summary>
|
||||
/// 删除时间 ,默认为最大值,表示未不删除
|
||||
/// </summary>
|
||||
public DateTime DeleteTime { get; set; } = DateTime.MaxValue;
|
||||
}
|
||||
|
||||
public class FileUserRequestReturn
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long UserId { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public long FileSize { get; set; }
|
||||
public string ContentType { get; set; }
|
||||
public string Hash { get; set; }
|
||||
public string Url { get; set; }
|
||||
public DateTime UploadTime { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
/// <summary>
|
||||
/// 删除时间 ,默认为最大值,表示未不删除
|
||||
/// </summary>
|
||||
public DateTime DeleteTime { get; set; } = DateTime.MaxValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace LMS.Repository.FileUpload;
|
||||
public class QiniuSettings
|
||||
{
|
||||
public string AccessKey { get; set; }
|
||||
public string SecretKey { get; set; }
|
||||
public string BucketName { get; set; }
|
||||
public string Domain { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除时间 天数 没有值 则不删除
|
||||
/// </summary>
|
||||
public int? DeleteDay { get; set; }
|
||||
}
|
||||
|
||||
public class FileUploadSettings
|
||||
{
|
||||
public long MaxFileSize { get; set; } = 3 * 1024 * 1024; // 5MB
|
||||
public List<string> AllowedContentTypes { get; set; } = new();
|
||||
}
|
||||
Reference in New Issue
Block a user