Browse Source

群主转让、群注销

zouxuan 1 year ago
parent
commit
2638ea38f0

+ 7 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/im/impl/ImGroupCoreServiceImpl.java

@@ -531,7 +531,13 @@ public class ImGroupCoreServiceImpl implements ImGroupCoreService {
         imPluginContext.getPluginService().changeGroupOwner(groupId, newOwner, oldOwner);
         imPluginContext.getPluginService().changeGroupOwner(groupId, newOwner, oldOwner);
         //设置管理员
         //设置管理员
         if(StringUtils.isNotEmpty(oldOwner)){
         if(StringUtils.isNotEmpty(oldOwner)){
-            imPluginContext.getPluginService().groupAdminCreate(groupId, oldOwner);
+            ImGroupMemberPlus one = imGroupMemberPlusService.lambdaQuery().eq(ImGroupMemberPlus::getImGroupId, groupId)
+                    .eq(ImGroupMemberPlus::getUserId, Long.parseLong(oldOwner)).last("LIMIT 1").one();
+            if(Objects.nonNull(one)){
+                if(StringUtils.isNotEmpty(one.getGroupRoleType()) && !StringUtils.equals(one.getGroupRoleType(),"Member")){
+                    imPluginContext.getPluginService().groupAdminCreate(groupId, oldOwner);
+                }
+            }
         }
         }
     }
     }