oss板块
This commit is contained in:
+23
-1
@@ -9,10 +9,32 @@ namespace SimpleAdmin.Web.Core;
|
||||
public class OnboardingContractTemplateController
|
||||
{
|
||||
private readonly IOnboardingContractTemplateService _service;
|
||||
private readonly IFileService _fileService;
|
||||
|
||||
public OnboardingContractTemplateController(IOnboardingContractTemplateService service)
|
||||
public OnboardingContractTemplateController(
|
||||
IOnboardingContractTemplateService service,
|
||||
IFileService fileService)
|
||||
{
|
||||
_service = service;
|
||||
_fileService = fileService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将入职合同 DOCX 模板上传到阿里云 OSS。
|
||||
/// </summary>
|
||||
[HttpPost("file/upload-docx")]
|
||||
[Consumes("multipart/form-data")]
|
||||
[RequestSizeLimit(20 * 1024 * 1024)]
|
||||
public async Task<long> UploadDocx([FromForm] IFormFile file)
|
||||
{
|
||||
if (file == null || file.Length == 0)
|
||||
throw Oops.Bah("请选择需要上传的 DOCX 文件");
|
||||
|
||||
var suffix = Path.GetExtension(file.FileName);
|
||||
if (!string.Equals(suffix, ".docx", StringComparison.OrdinalIgnoreCase))
|
||||
throw Oops.Bah("合同模板仅支持 DOCX 文件");
|
||||
|
||||
return await _fileService.UploadFile(SysDictConst.FILE_ENGINE_ALIYUN_OSS, file);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+6
-3
@@ -59,11 +59,14 @@ public class OnboardingPublicSubmissionController
|
||||
[HttpPost("upload-material")]
|
||||
[Consumes("multipart/form-data")]
|
||||
[RequestSizeLimit(20 * 1024 * 1024)]
|
||||
public async Task UploadMaterial([FromForm] string token, [FromForm] long materialTypeId, IFormFile file)
|
||||
public async Task UploadMaterial(
|
||||
[FromQuery] string token,
|
||||
[FromQuery] long materialTypeId,
|
||||
[FromForm] IFormFile file)
|
||||
{
|
||||
if (file == null || file.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("请选择需要上传的文件");
|
||||
throw Oops.Bah("请选择需要上传的文件");
|
||||
}
|
||||
|
||||
await _service.ValidateMaterialUpload(new OnboardingMaterialUploadValidationInput
|
||||
@@ -74,7 +77,7 @@ public class OnboardingPublicSubmissionController
|
||||
FileLength = file.Length
|
||||
});
|
||||
|
||||
var fileId = await _fileService.UploadFile(SysDictConst.FILE_ENGINE_LOCAL, file);
|
||||
var fileId = await _fileService.UploadFile(SysDictConst.FILE_ENGINE_ALIYUN_OSS, file);
|
||||
await _service.SaveMaterial(new OnboardingSaveMaterialInput
|
||||
{
|
||||
Token = token,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
global using MoYu;
|
||||
global using MoYu.DynamicApiController;
|
||||
global using MoYu.FriendlyException;
|
||||
global using MoYu.Logging;
|
||||
global using Microsoft.AspNetCore.Authorization;
|
||||
global using Microsoft.AspNetCore.Builder;
|
||||
|
||||
@@ -91,6 +91,11 @@
|
||||
提供合同模板、版本、变量和适用范围相关 HTTP 接口。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Web.Core.OnboardingContractTemplateController.UploadDocx(Microsoft.AspNetCore.Http.IFormFile)">
|
||||
<summary>
|
||||
将入职合同 DOCX 模板上传到阿里云 OSS。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:SimpleAdmin.Web.Core.OnboardingContractTemplateController.Page(SimpleAdmin.Application.OnboardingContractTemplatePageInput)">
|
||||
<summary>
|
||||
分页查询合同模板。
|
||||
|
||||
Reference in New Issue
Block a user