李昊 il y a 4 ans
Parent
commit
2fa8bf5db2

+ 12 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/Group/GroupService.RemoveUser.cs

@@ -64,6 +64,18 @@ namespace GxPress.Service.Implement.Group
                 query.Where(nameof(Entity.Middle.Middle.MiddleId), groupId);
                 await _middleRepository.DeleteAsync(query);
             }
+            else
+            {
+                query = Q.NewQuery();
+                query.Where(nameof(Entity.GroupUser.UserId), userId);
+                query.Where(nameof(Entity.GroupUser.GroupId), groupId);
+                await _groupUserRepository.DeleteAsync(query);
+                query = Q.NewQuery();
+                query.Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Group.GetHashCode());
+                query.Where(nameof(Entity.Middle.Middle.MiddleId), groupId);
+                query.Where(nameof(Entity.Middle.Middle.UserId), userId);
+                await _middleRepository.DeleteAsync(query);
+            }
             if (groupUser.GroupUserRoleId == GroupUserRoleTyeConst.SuperAdmin)
                 throw new BusinessException("你的身份是小组创建者,请先转让小组给他人,然后才能退出小组!");
             return true;