コード例 #1
0
ファイル: postingmanager.php プロジェクト: akniyev/arteva.ru
 /**
  * @param $recipientId
  * @param $url
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function click($recipientId, $url)
 {
     $postingContactPrimary = array('ID' => $recipientId);
     $arPostingEmail = PostingRecipientTable::getRowById($postingContactPrimary);
     if ($arPostingEmail && $arPostingEmail['ID']) {
         $arPostingRead = PostingReadTable::getRowById(array('POSTING_ID' => $arPostingEmail['POSTING_ID'], 'RECIPIENT_ID' => $arPostingEmail['ID']));
         if ($arPostingRead === null) {
             static::read($recipientId);
         }
         $postingDb = PostingTable::getList(array('select' => array('ID'), 'filter' => array('ID' => $arPostingEmail['POSTING_ID'], 'MAILING.TRACK_CLICK' => 'Y')));
         if ($postingDb->fetch()) {
             PostingClickTable::add(array('POSTING_ID' => $arPostingEmail['POSTING_ID'], 'RECIPIENT_ID' => $arPostingEmail['ID'], 'URL' => $url));
         }
     }
 }
コード例 #2
0
 /**
  * @param $recipientId
  * @param $url
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function click($recipientId, $url)
 {
     $postingContactPrimary = array('ID' => $recipientId);
     $recipient = PostingRecipientTable::getRowById($postingContactPrimary);
     if ($recipient && $recipient['ID']) {
         $read = PostingReadTable::getRowById(array('POSTING_ID' => $recipient['POSTING_ID'], 'RECIPIENT_ID' => $recipient['ID']));
         if ($read === null) {
             static::read($recipientId);
         }
         $postingDb = PostingTable::getList(array('select' => array('ID'), 'filter' => array('ID' => $recipient['POSTING_ID'])));
         if ($postingDb->fetch()) {
             $fixedUrl = str_replace(array('&bx_sender_conversion_id=' . $recipient['ID'], '?bx_sender_conversion_id=' . $recipient['ID']), array('', ''), $url);
             $addClickDb = PostingClickTable::add(array('POSTING_ID' => $recipient['POSTING_ID'], 'RECIPIENT_ID' => $recipient['ID'], 'URL' => $fixedUrl));
             if ($addClickDb->isSuccess()) {
                 // send event
                 $eventData = array('URL' => $url, 'URL_FIXED' => $fixedUrl, 'CLICK_ID' => $addClickDb->getId(), 'RECIPIENT' => $recipient);
                 $event = new Event('sender', 'OnAfterRecipientClick', array($eventData));
                 $event->send();
             }
         }
     }
 }
コード例 #3
0
ファイル: postingmanager.php プロジェクト: Hawkart/megatv
 /**
  * Do click actions
  *
  * @param $recipientId
  * @param $url
  * @return void
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function click($recipientId, $url)
 {
     $postingContactPrimary = array('ID' => $recipientId);
     $recipient = PostingRecipientTable::getRowById($postingContactPrimary);
     if ($recipient && $recipient['ID']) {
         $read = PostingReadTable::getRowById(array('POSTING_ID' => $recipient['POSTING_ID'], 'RECIPIENT_ID' => $recipient['ID']));
         if ($read === null) {
             static::read($recipientId);
         }
         $postingDb = PostingTable::getList(array('select' => array('ID'), 'filter' => array('ID' => $recipient['POSTING_ID'])));
         if ($postingDb->fetch()) {
             $uri = new \Bitrix\Main\Web\Uri($url);
             $fixedUrl = $uri->deleteParams(array('bx_sender_conversion_id'))->getLocator();
             $addClickDb = PostingClickTable::add(array('POSTING_ID' => $recipient['POSTING_ID'], 'RECIPIENT_ID' => $recipient['ID'], 'URL' => $fixedUrl));
             if ($addClickDb->isSuccess()) {
                 // send event
                 $eventData = array('URL' => $url, 'URL_FIXED' => $fixedUrl, 'CLICK_ID' => $addClickDb->getId(), 'RECIPIENT' => $recipient);
                 $event = new Event('sender', 'OnAfterRecipientClick', array($eventData));
                 $event->send();
             }
         }
     }
 }