李昊 4 년 전
부모
커밋
2fa8bf5db2
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      gx_api/GxPress/Service/GxPress.Service.Implement/Group/GroupService.RemoveUser.cs

+ 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;