瀏覽代碼

修复请求头TenantId未传时引发异常

Linhaibo 5 月之前
父節點
當前提交
c92d23f95a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarRepository.cs

+ 1 - 1
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarRepository.cs

@@ -39,7 +39,7 @@ public class SqlSugarRepository<T> : SimpleClient<T>, ISqlSugarRepository<T> whe
             return;
 
         // 看请求头有没有租户id
-        var tenantId = App.HttpContext?.Request.Headers.GetValue(ClaimConst.TenantId).ToString();
+        var tenantId = App.HttpContext?.Request.Headers.GetValue(ClaimConst.TenantId, false)?.ToString();
         if (tenantId == SqlSugarConst.MainConfigId) return;
         else if (string.IsNullOrWhiteSpace(tenantId))
         {