• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/notify.php
  • Класс: BitrixImNotify
  • Вызов: Notify::getLastId
public function getLastId(): ?int
{
	if (!$this->chatId)
	{
		return null;
	}

	$ormParams = [
		'select' => ['ID'],
		'filter' => ['=CHAT_ID' => $this->chatId],
		'order' => ['DATE_CREATE' => 'DESC', 'ID' => 'DESC'],
		'limit' => 1,
	];

	$getListResult = BitrixImModelMessageTable::getList($ormParams)->fetch();
	if (!$getListResult)
	{
		return null;
	}

	if (count($getListResult) === 1)
	{
		return (int)$getListResult['ID'];
	}

	return null;
}