Merge branch 'Test.Study' of http://192.168.3.69:3000/XCKJ/irc-netcore-api into Test.Study
commit
b154540885
|
@ -973,7 +973,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
[HttpPost, Route("TrialSiteSurvey/TestOOS")]
|
||||
public string TestUploadFileToOOS(string path)
|
||||
{
|
||||
return FileStoreHelper.UploadOOS(path, true);
|
||||
return FileStoreHelper.UploadOOS(path, "testc/test", true);
|
||||
}
|
||||
|
||||
[HttpPost, Route("TrialSiteSurvey/UploadTrialSiteSurveyUser")]
|
||||
|
|
|
@ -20,13 +20,20 @@ public static class FileStoreHelper
|
|||
/// 上传文件到OOS
|
||||
/// </summary>
|
||||
/// <param name="filePath">本地文件路径</param>
|
||||
/// <param name="oosPath">OOS路径例如(test/test)</param>
|
||||
/// <param name="isDeleteOriginalFile">是否删除本地文件</param>
|
||||
/// <returns>返回文件路径</returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
public static string UploadOOS(string filePath, bool isDeleteOriginalFile)
|
||||
public static string UploadOOS(string filePath,string oosPath, bool isDeleteOriginalFile)
|
||||
{
|
||||
var config = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
var enviromentName = config["ASPNETCORE_ENVIRONMENT"];
|
||||
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile($"appsettings.{enviromentName}.json")
|
||||
.Build();
|
||||
|
||||
var endpoint = configuration.GetSection("AliyunOSS:endpoint").Value;
|
||||
|
@ -41,7 +48,10 @@ public static class FileStoreHelper
|
|||
|
||||
var fileNameList = filePath.Split('\\').ToList();
|
||||
var fileName = fileNameList[fileNameList.Count() - 1];
|
||||
|
||||
if (oosPath != string.Empty)
|
||||
{
|
||||
fileName = oosPath + "/" + fileName;
|
||||
}
|
||||
var objectName = fileName;
|
||||
// 填写本地文件完整路径,例如D:\\localpath\\examplefile.txt。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
|
||||
var localFilename = filePath;
|
||||
|
|
|
@ -34,11 +34,12 @@
|
|||
主要为了 处理项目结束 锁库,不允许操作
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Helper.FileStoreHelper.UploadOOS(System.String,System.Boolean)">
|
||||
<member name="M:IRaCIS.Core.Application.Helper.FileStoreHelper.UploadOOS(System.String,System.String,System.Boolean)">
|
||||
<summary>
|
||||
上传文件到OOS
|
||||
</summary>
|
||||
<param name="filePath">本地文件路径</param>
|
||||
<param name="oosPath">OOS路径例如(test/test)</param>
|
||||
<param name="isDeleteOriginalFile">是否删除本地文件</param>
|
||||
<returns>返回文件路径</returns>
|
||||
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
|
||||
|
|
Loading…
Reference in New Issue