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
Hewt 2026-03-24 11:33:37 +08:00
commit 49ffbad759
1 changed files with 23 additions and 19 deletions

View File

@ -196,7 +196,7 @@ public interface IOSSService
List<string> GetRootFolderNames(); List<string> GetRootFolderNames();
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null); public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null);
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true); public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
@ -1502,9 +1502,9 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
{ {
foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync)) foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync))
{ {
ObjectStoreServiceOptions.ObjectStoreUse = config.Primary;
GetObjectStoreTempToken();
GetObjectStoreTempToken(objectUse: config.Primary);
await DeleteFromPrefixInternal(prefix, isCache); await DeleteFromPrefixInternal(prefix, isCache);
} }
@ -1678,9 +1678,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
{ {
foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync)) foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync))
{ {
ObjectStoreServiceOptions.ObjectStoreUse = config.Primary;
GetObjectStoreTempToken(); GetObjectStoreTempToken(objectUse: config.Primary);
await DeleteObjectsInternal(objectKeys, isCache); await DeleteObjectsInternal(objectKeys, isCache);
} }
@ -1858,30 +1857,35 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null) public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null)
{ {
string objectStoreUse = string.Empty; string objectStoreUse = string.Empty;
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置 //使用指定配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty()) if (objectUse != null)
{ {
var userDomain = domain?.Trim(); objectStoreUse = objectUse?.Trim() ?? string.Empty;
}
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == userDomain); //根据域名动态判断
if (find != null) else
{
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty() && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.Domain == domain))
{ {
objectStoreUse = find.Primary;
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == domain);
if (find != null)
{
objectStoreUse = find.Primary;
}
} }
else else
{ {
//本地localhost 时候,默认给值 //兜底,如果是本地测试环境,那就使用部署默认配置
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse; objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
} }
} }
else
{
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
}
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = objectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList }; var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = objectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };