Commit 786e64ee authored by Олег Гиммельшпах's avatar Олег Гиммельшпах

Merge branch 'master' of git.task-on.com:ktask/task-on.com

parents fe61fd25 04a74632
......@@ -115,6 +115,17 @@ class UnisenderAPI {
return $this->statuses;
}
/**
* @return bool
*/
public function isUnsubscribed(){
if (array_key_exists('result', $this->statuses) && array_key_exists('status', $this->statuses['result'])) {
if ($this->statuses['result']['status']==ConditionBase::MESSAGE_UNSUBSCRIBED)
return true;
}
return false;
}
/**
* @return bool
*/
......
<?php
namespace common\modules\triggers\components\conditions\conditions;
use common\components\UnisenderAPI;
use common\modules\triggers\components\conditions\vendor\ConditionBase;
use common\modules\triggers\components\conditions\vendor\ConditionInterface;
class CheckEmailToUnsubscribed extends ConditionBase implements ConditionInterface{
const CONDITION_ID = 4;
public $name = 'Пользователь отписался';
/**
* @param null|string $conditionName
* @return $this mixed
*/
public static function init($conditionName=__CLASS__){
return parent::init($conditionName);
}
/**
* @param $message
* @return bool
*/
public function check($message){
if (!is_null($message)) {
// Создаем объект унисендера
$sender=new UnisenderAPI();
// Делаем запрос на получение статуса сообщения
$sender->getMessageStatuses($message->message_id);
return $sender->isUnsubscribed();
}
return true;
}
}
\ No newline at end of file
......@@ -6,6 +6,9 @@ return [
'check-email-to-opening' => [
'class' => 'common\modules\triggers\components\conditions\conditions\CheckEmailToDelivered',
],
'check-email-to-unsubscribed' => [
'class' => 'common\modules\triggers\components\conditions\conditions\CheckEmailToUnsubscribed',
],
'check-clicking-on-the-link' => [
'class' => 'common\modules\triggers\components\conditions\conditions\CheckClickingOnTheLink',
'params' => [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment