com.akaxin.proto.plugin.HaiGroupRemoveMemberProto Java Examples

The following examples show how to use com.akaxin.proto.plugin.HaiGroupRemoveMemberProto. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpGroupService.java    From wind-im with Apache License 2.0 5 votes vote down vote up
/**
 * /hai/group/removeMember : 删除群成员
 * 
 * @param command
 * @return
 */
public CommandResponse removeMember(Command command) {
	CommandResponse commandResponse = new CommandResponse();
	ErrorCode2 errCode = ErrorCode2.ERROR;
	try {
		HaiGroupRemoveMemberProto.HaiGroupRemoveMemberRequest request = HaiGroupRemoveMemberProto.HaiGroupRemoveMemberRequest
				.parseFrom(command.getParams());
		String groupId = request.getGroupId();
		if (!checkGroupIdLegal(groupId)) {
			throw new ZalyException2(ErrorCode2.ERROR_PARAMETER);
		}

		ProtocolStringList deleteMemberIds = request.getGroupMemberList();
		LogUtils.requestDebugLog(logger, command, request.toString());
		//无法删除群主
		String groupMaster = UserGroupDao.getInstance().getGroupMaster(groupId);
		for (String deleteMemberId : deleteMemberIds) {
			if (!checkUserIdLegal(deleteMemberId)) {
				throw new ZalyException2(ErrorCode2.ERROR_PARAMETER);
			}
			if (groupMaster.equals(deleteMemberId)) {
				throw new ZalyException2(ErrorCode2.ERROR_NOPERMISSION);
			}
		}
		if (UserGroupDao.getInstance().deleteGroupMember(groupId, deleteMemberIds)) {
			errCode = ErrorCode2.SUCCESS;
		}

	} catch (Exception e) {
		errCode = ErrorCode2.ERROR_SYSTEMERROR;
		LogUtils.requestErrorLog(logger, command, e);
	} catch (ZalyException2 zalyException2) {
		errCode = (ErrorCode2) zalyException2.getErrCode();
		LogUtils.requestErrorLog(logger, command, zalyException2);
	}
	return commandResponse.setErrCode2(errCode);
}
 
Example #2
Source File: HttpGroupService.java    From openzaly with Apache License 2.0 5 votes vote down vote up
/**
 * /hai/group/removeMember : 删除群成员
 * 
 * @param command
 * @return
 */
public CommandResponse removeMember(Command command) {
	CommandResponse commandResponse = new CommandResponse();
	ErrorCode2 errCode = ErrorCode2.ERROR;
	try {
		HaiGroupRemoveMemberProto.HaiGroupRemoveMemberRequest request = HaiGroupRemoveMemberProto.HaiGroupRemoveMemberRequest
				.parseFrom(command.getParams());
		String groupId = request.getGroupId();
		if (!checkGroupIdLegal(groupId)) {
			throw new ZalyException2(ErrorCode2.ERROR_PARAMETER);
		}

		ProtocolStringList deleteMemberIds = request.getGroupMemberList();
		LogUtils.requestDebugLog(logger, command, request.toString());
		//无法删除群主
		String groupMaster = UserGroupDao.getInstance().getGroupMaster(groupId);
		for (String deleteMemberId : deleteMemberIds) {
			if (!checkUserIdLegal(deleteMemberId)) {
				throw new ZalyException2(ErrorCode2.ERROR_PARAMETER);
			}
			if (groupMaster.equals(deleteMemberId)) {
				throw new ZalyException2(ErrorCode2.ERROR_NOPERMISSION);
			}
		}
		if (UserGroupDao.getInstance().deleteGroupMember(groupId, deleteMemberIds)) {
			errCode = ErrorCode2.SUCCESS;
		}

	} catch (Exception e) {
		errCode = ErrorCode2.ERROR_SYSTEMERROR;
		LogUtils.requestErrorLog(logger, command, e);
	} catch (ZalyException2 zalyException2) {
		errCode = (ErrorCode2) zalyException2.getErrCode();
		LogUtils.requestErrorLog(logger, command, zalyException2);
	}
	return commandResponse.setErrCode2(errCode);
}
 
Example #3
Source File: HttpGroupService.java    From openzaly with Apache License 2.0 5 votes vote down vote up
/**
 * /hai/group/removeMember : 删除群成员
 * 
 * @param command
 * @return
 */
public CommandResponse removeMember(Command command) {
	CommandResponse commandResponse = new CommandResponse();
	ErrorCode2 errCode = ErrorCode2.ERROR;
	try {
		HaiGroupRemoveMemberProto.HaiGroupRemoveMemberRequest request = HaiGroupRemoveMemberProto.HaiGroupRemoveMemberRequest
				.parseFrom(command.getParams());
		String groupId = request.getGroupId();
		if (!checkGroupIdLegal(groupId)) {
			throw new ZalyException2(ErrorCode2.ERROR_PARAMETER);
		}

		ProtocolStringList deleteMemberIds = request.getGroupMemberList();
		LogUtils.requestDebugLog(logger, command, request.toString());
		//无法删除群主
		String groupMaster = UserGroupDao.getInstance().getGroupMaster(groupId);
		for (String deleteMemberId : deleteMemberIds) {
			if (!checkUserIdLegal(deleteMemberId)) {
				throw new ZalyException2(ErrorCode2.ERROR_PARAMETER);
			}
			if (groupMaster.equals(deleteMemberId)) {
				throw new ZalyException2(ErrorCode2.ERROR_NOPERMISSION);
			}
		}
		if (UserGroupDao.getInstance().deleteGroupMember(groupId, deleteMemberIds)) {
			errCode = ErrorCode2.SUCCESS;
		}

	} catch (Exception e) {
		errCode = ErrorCode2.ERROR_SYSTEMERROR;
		LogUtils.requestErrorLog(logger, command, e);
	} catch (ZalyException2 zalyException2) {
		errCode = (ErrorCode2) zalyException2.getErrCode();
		LogUtils.requestErrorLog(logger, command, zalyException2);
	}
	return commandResponse.setErrCode2(errCode);
}