Compare commits

..

No commits in common. "8ac515acbd0e2321c413a1b667fcaed76a228e91" and "f172a15e6e35767a8a6bea93284a7371b4443589" have entirely different histories.

1 changed files with 9 additions and 15 deletions

View File

@ -1860,8 +1860,6 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null)
{
string objectStoreUse = string.Empty;
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty())
{
@ -1870,17 +1868,13 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == userDomain);
if (find != null)
{
objectStoreUse = find.Primary;
ObjectStoreServiceOptions.ObjectStoreUse = find.Primary;
}
}
else
{
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
}
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = objectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
if (objectStoreUse == "AliyunOSS" || isGetAllTempToken == true)
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS" || isGetAllTempToken == true)
{
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
@ -1928,11 +1922,11 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
objectStoreDTO.AliyunOSS = tempToken;
}
if (objectStoreUse == "MinIO")
if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
objectStoreDTO.MinIO = ObjectStoreServiceOptions.MinIO;
}
if (objectStoreUse == "AWS" || isGetAllTempToken == true)
if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS" || isGetAllTempToken == true)
{
var awsOptions = ObjectStoreServiceOptions.AWS;
@ -1978,10 +1972,6 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
objectStoreDTO.AWS = tempToken;
}
if (objectStoreUse.IsNullOrEmpty())
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
}
return objectStoreDTO;
}
@ -2073,6 +2063,10 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
throw new BusinessValidationFailedException("未定义的同步类型");
}
}
catch (Exception ex)
{
Log.Error($"同步错误:{ex.Message}");
}
finally
{
// ⭐⭐⭐ 真正释放 HTTP 连接