Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

Test_IRC_Net8
he 2026-03-10 14:23:58 +08:00
commit 3c2701fe9d
4 changed files with 52 additions and 11 deletions

View File

@ -25,6 +25,7 @@ using Microsoft.Extensions.Options;
using Org.BouncyCastle.Tls;
using RestSharp;
using RestSharp.Authenticators;
using Serilog;
using System;
using System.Collections.Generic;
using System.Globalization;
@ -137,10 +138,15 @@ namespace IRaCIS.Api.Controllers
public async Task<IResponseOutput> GetObjectStoreTokenAsync([FromServices] IOptionsMonitor<ObjectStoreServiceOptions> options, [FromServices] IOSSService _oSSService)
{
var result = _oSSService.GetObjectStoreTempToken();
var domain = HttpContext.Request.Host.Host;
var result = _oSSService.GetObjectStoreTempToken(domain);
//result.AWS = await GetAWSTemToken(options.CurrentValue);
Log.Logger.Information($"使用域名:{domain}请求token.返回{result.ToJsonStr()}");
return ResponseOutput.Ok(result);
}

View File

@ -28,6 +28,19 @@
"ObjectStoreService": {
// 使
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": false,
"SyncConfigList": [
{
"Domain": "ir.test.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS"
},
{
"Domain": "lili.test.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS"
}
],
//
"AliyunOSS": {
// OSS Region ID

View File

@ -16,6 +16,7 @@ using Minio;
using Minio.DataModel;
using Minio.DataModel.Args;
using Minio.Exceptions;
using Serilog.Parsing;
using System.IO;
using System.Reactive.Linq;
using System.Runtime.InteropServices;
@ -82,7 +83,7 @@ public class ObjectStoreServiceOptions
public bool IsOpenStoreSync { get; set; }
public List<SyncStoreConfig> SyncConfigList { get; set; }
public List<SyncStoreConfig> SyncConfigList { get; set; } = new List<SyncStoreConfig>();
}
@ -107,6 +108,10 @@ public class ObjectStoreDTO
public AWSTempToken AWS { get; set; }
public bool IsOpenStoreSync { get; set; }
public List<SyncStoreConfig> SyncConfigList { get; set; }
}
[LowerCamelCaseJson]
@ -178,7 +183,7 @@ public interface IOSSService
List<string> GetRootFolderNames();
public ObjectStoreDTO GetObjectStoreTempToken();
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null);
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
@ -1769,13 +1774,26 @@ public class OSSService : IOSSService
public ObjectStoreDTO GetObjectStoreTempToken()
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null)
{
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty())
{
var userDomain = domain?.Trim();
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == userDomain);
if (find != null)
{
ObjectStoreServiceOptions.ObjectStoreUse = find.Primary;
}
}
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse= ObjectStoreServiceOptions.ObjectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync ,SyncConfigList= ObjectStoreServiceOptions .SyncConfigList};
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
{
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
var client = new Client(new AlibabaCloud.OpenApiClient.Models.Config()
{
AccessKeyId = ossOptions.AccessKeyId,
@ -1817,11 +1835,12 @@ public class OSSService : IOSSService
AliyunOSSTempToken = tempToken;
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, AliyunOSS = tempToken };
objectStoreDTO.AliyunOSS = tempToken;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, MinIO = ObjectStoreServiceOptions.MinIO };
objectStoreDTO.MinIO = ObjectStoreServiceOptions.MinIO;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
{
@ -1865,12 +1884,15 @@ public class OSSService : IOSSService
};
AWSTempToken = tempToken;
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, AWS = tempToken };
objectStoreDTO.AWS = tempToken;
}
else
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
}
return objectStoreDTO;
}
}

View File

@ -16922,17 +16922,17 @@
</member>
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
<summary>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
质疑
</summary>
</member>
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
<summary>
һ<EFBFBD><EFBFBD><EFBFBD>Ժ˲<EFBFBD>
一致性核查
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
<summary>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
复制
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">