Ejemplo n.º 1
0
 /**
  * Добавляет цель
  *
  * @param CampaignsActions $action
  *
  * @return bool
  */
 public function addAction(CampaignsActions $action)
 {
     $encryptedId = $action->getEncryptedId();
     $key = $this->getCampaignActionsKey($action->campaign_id);
     $this->redis()->sAdd($key, $encryptedId);
     $key = $this->getActionKey($encryptedId);
     $this->redis()->hMset($key, $action->getAttributes(array('id', 'target_type', 'target_match_type', 'target', 'campaign_id')));
 }
Ejemplo n.º 2
0
 /**
  * Возвращает объект цели по переданному идентификатору
  *
  * @return CampaignsActions
  */
 private function getAction()
 {
     if (!isset($this->action)) {
         if (!isset($this->args['action_id'])) {
             return null;
         }
         $this->action = CampaignsActions::model()->findByPk($this->args['action_id']);
     }
     return $this->action;
 }
Ejemplo n.º 3
0
 /**
  *	Возвращает список целей для кампании, которые еще не привязаны к офферам
  *	@param int $campaign_id
  **/
 public function getAvailableCampaignActions($campaign_id)
 {
     $CampaignsActions = CampaignsActions::model();
     $criteria = new CDbCriteria();
     $criteria->alias = 'A';
     $criteria->select = 'A.*';
     $_condition = 'A.campaign_id = :campaign_id AND A.is_deleted = 0 ';
     $_params = array(':campaign_id' => $campaign_id);
     $criteria->condition = $_condition;
     $criteria->params = $_params;
     $actions = $CampaignsActions->findAll($criteria);
     return $actions;
 }