• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/notify.php
  • Класс: BitrixImNotify
  • Вызов: Notify::prepareGettingIdParams
private function prepareGettingIdParams(int $requestType, int $limit): array
{
	$ormParams = [
		'select' => ['ID'],
		'filter' => ['=CHAT_ID' => $this->chatId],
		'order' => ['DATE_CREATE' => 'DESC', 'ID' => 'DESC'],
		'limit' => $limit
	];

	if ($requestType === self::CONFIRM_TYPE)
	{
		$ormParams['filter']['=NOTIFY_TYPE'] = IM_NOTIFY_CONFIRM;
	}
	elseif ($requestType === self::SIMPLE_TYPE)
	{
		$ormParams['filter']['!=NOTIFY_TYPE'] = IM_NOTIFY_CONFIRM;
	}
	elseif ($requestType === self::ALL_TYPES)
	{
		if ($this->searchText)
		{
			$ormParams['filter']['*%MESSAGE'] = $this->searchText;
		}
		if ($this->searchType)
		{
			$options = explode('|', $this->searchType);
			$ormParams['filter']['=NOTIFY_MODULE'] = $options[0];
			if (isset($options[1]))
			{
				$ormParams['filter']['=NOTIFY_EVENT'] = $options[1];
			}
		}
		if ($this->searchDate)
		{
			$dateStart = new DateTime(
				$this->searchDate,
				DateTimeInterface::RFC3339,
				new DateTimeZone('UTC')
			);
			$dateEnd = (
				new DateTime(
					$this->searchDate,
					DateTimeInterface::RFC3339,
					new DateTimeZone('UTC')
				)
			)->add('1 DAY');
			$ormParams['filter']['>firstPage)
	{
		if (
			$requestType === self::CONFIRM_TYPE
			|| ($requestType === self::SIMPLE_TYPE && $this->lastType === self::SIMPLE_TYPE)
			|| ($requestType === self::ALL_TYPES && $this->lastType === self::ALL_TYPES)
		)
		{
			$ormParams['filter']['lastId;
		}
	}

	return $ormParams;
}