😎匿名接口增加数据时默认租户ID
This commit is contained in:
parent
f5183e4acc
commit
39ef29673c
@ -67,4 +67,15 @@ public class TestService : IDynamicApiController
|
||||
|
||||
_logger.LogWarning($"信息{DateTime.Now}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 匿名上传文件测试
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<SysFile> UploadFile([FromForm] UploadFileInput input)
|
||||
{
|
||||
return await App.GetRequiredService<SysFileService>().UploadFile(input);
|
||||
}
|
||||
}
|
||||
@ -54,9 +54,9 @@
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.12.0" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.189" />
|
||||
<PackageReference Include="SSH.NET" Version="2025.0.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.2" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.2" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1226" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1227" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -238,7 +238,7 @@ public static class SqlSugarSetup
|
||||
if (entityInfo.PropertyName == nameof(EntityTenantId.TenantId))
|
||||
{
|
||||
if (entityValue.TenantId == null || entityValue.TenantId == 0)
|
||||
entityInfo.SetValue(App.User.FindFirst(ClaimConst.TenantId)?.Value);
|
||||
entityInfo.SetValue(App.User.FindFirst(ClaimConst.TenantId)?.Value ?? SqlSugarConst.DefaultTenantId.ToString());
|
||||
}
|
||||
else if (entityInfo.PropertyName == nameof(EntityBase.CreateUserId))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user