• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/session.php
  • Класс: BitrixImOpenLinesSession
  • Вызов: Session::prolongDueChatActivity
static function prolongDueChatActivity($chatId)
{
	$orm = ModelSessionTable::getList([
		'select' => [
			'ID',
			'CHECK_DATE_CLOSE' => 'CHECK.DATE_CLOSE'
		],
		'filter' => [
			'=CHAT_ID' => $chatId,
			'=CLOSED' => 'N'
		]
	]);

	if ($result = $orm->fetch())
	{
		$currentDate = new DateTime();
		if ($result['CHECK_DATE_CLOSE'] && $currentDate->getTimestamp()+600 > $result['CHECK_DATE_CLOSE']->getTimestamp())
		{
			$dateClose = $result['CHECK_DATE_CLOSE']->add('10 MINUTES');
			ModelSessionCheckTable::update($result['ID'], [
				'DATE_CLOSE' => $dateClose
			]);
		}
	}
}