• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/retargeting/audience.php
  • Класс: BitrixSeoRetargetingAudience
  • Вызов: Audience::addToQueue
protected function addToQueue($audienceId, $contacts, $options = [], $isRemove = false)
{
	$dateAutoRemove = null;
	if ($this->isQueueAutoRemove && $this->queueDaysAutoRemove > 0)
	{
		$dateAutoRemove = new DateTime();
		$dateAutoRemove->add($this->queueDaysAutoRemove . ' DAY');
	}

	if ($isRemove)
	{
		$action = QueueTable::ACTION_REMOVE;
	}
	else if ($this->isQueueAutoRemove)
	{
		$action = QueueTable::ACTION_IMPORT_AND_AUTO_REMOVE;
	}
	else
	{
		$action = QueueTable::ACTION_IMPORT;
	}


	foreach (static::$listRowMap['SUPPORTED_CONTACT_TYPES'] as $contactType)
	{
		if (!isset($contacts[$contactType]))
		{
			continue;
		}

		$contactsCount = count($contacts[$contactType]);
		for ($i = 0; $i < $contactsCount; $i++)
		{
			$contact = $contacts[$contactType][$i];
			$resultDb = QueueTable::add(array(
				'TYPE' => static::TYPE_CODE,
				'ACCOUNT_ID' => $this->accountId,
				'CLIENT_ID' => $this->service instanceof IMultiClientService ? $this->service->getClientId() : null,
				'AUDIENCE_ID' => $audienceId,
				'PARENT_ID' => $options['parentId'] ?: null,
				'CONTACT_TYPE' => $contactType,
				'VALUE' => $contact,
				'ACTION' => $action,
				'DATE_AUTO_REMOVE' => $dateAutoRemove,
			));
			$resultDb->isSuccess();
		}
	}

	return true;
}