Эх сурвалжийг харах

优化会员过滤器,平台用户登录不开启会员过滤器

zhontai 2 жил өмнө
parent
commit
24c03d23bf

+ 9 - 1
src/platform/ZhonTai.Admin/Core/Db/DbHelper.cs

@@ -481,7 +481,15 @@ public class DbHelper
             }
             }
 
 
             //会员过滤器
             //会员过滤器
-            fsql.GlobalFilter.ApplyOnly<IMember>(FilterNames.Member, a => a.MemberId == user.Id);
+            fsql.GlobalFilter.ApplyOnlyIf<IMember>(FilterNames.Member,
+                () =>
+                {
+                    if (user?.Id > 0 && user.Type != UserType.Member)
+                        return false;
+                    return true;
+                },
+                a => a.MemberId == user.Id
+            );
 
 
             //数据权限过滤器
             //数据权限过滤器
             fsql.GlobalFilter.ApplyOnlyIf<IData>(FilterNames.Self,
             fsql.GlobalFilter.ApplyOnlyIf<IData>(FilterNames.Self,