Commit 68774ee0 by hweeeeeei

会话的创建者退出时,是否需要转移给下一个client, true为转移, false暂时没开发

parent 4b5ddcec
......@@ -14,7 +14,7 @@ import java.util.List;
* @since 2021-04-29
*/
@Data
@ApiModel(value = "GetSignParam")
@ApiModel(value = "GetClientInfoParam")
public class GetClientInfoParam implements Serializable {
private static final long serialVersionUID = 1L;
......
......@@ -19,4 +19,7 @@ public class ImClientLeaveConversation extends BaseEntity {
@ApiModelProperty("会话表id")
private Long conversationId;
@ApiModelProperty("会话的创建者退出时,是否需要转移给下一个client, true为转移, false为不转移直接解散")
private Boolean transfer;
}
......@@ -472,6 +472,9 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
ImClient imClientSender = imClientService.getCurentClient();
ImConversation imConversationById = imConversationService.getById(imClientToConversation.getConversationId());
if (imConversationById == null) {
throw new Exception("imConversationById == null");
}
// 查询该会话所有成员
List<ImConversationMembers> membersList = imConversationMembersService.list(
......@@ -565,11 +568,17 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
}
// 判断是否为群主
if (imConversationById == null || !imConversationById.getCreator().equals(imClientSender.getId())) {
// return ApiResult.result(false);
// 群主退出 是否需要转移给下一个人
if (imConversationById.getCreator().equals(imClientSender.getId()) && imClientToConversation.getTransfer()) {
ImConversationMembers conversationMember = membersList.get(0);
imConversationById.setCreator(conversationMember.getFkClientId());
// 创建者权限转移给下一个人
imConversationService.updateById(imConversationById);
}
return ApiResult.ok();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment