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

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

parents c9eeb2d5 a3716eed
......@@ -120,7 +120,18 @@ class UnisenderAPI {
*/
public function isReaded(){
if (array_key_exists('result', $this->statuses) && array_key_exists('status', $this->statuses['result'])) {
if ($this->statuses['result']['status']==ConditionBase::MESSAGE_READ)
if ($this->statuses['result']['status']==ConditionBase::MESSAGE_READ || $this->statuses['result']['status']==ConditionBase::MESSAGE_UNSUBSCRIBED || $this->statuses['result']['status']==ConditionBase::MESSAGE_SPAM_FOLDER)
return true;
}
return false;
}
/**
* @return bool
*/
public function isDelivered(){
if (array_key_exists('result', $this->statuses) && array_key_exists('status', $this->statuses['result'])) {
if ($this->statuses['result']['status']==ConditionBase::MESSAGE_DELIVERED || $this->statuses['result']['status']==ConditionBase::MESSAGE_LINK_VISITED || $this->statuses['result']['status']==ConditionBase::MESSAGE_READ || $this->statuses['result']['status']==ConditionBase::MESSAGE_UNSUBSCRIBED || $this->statuses['result']['status']==ConditionBase::MESSAGE_SPAM_FOLDER)
return true;
}
return false;
......
<?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 CheckEmailToDelivered extends ConditionBase implements ConditionInterface{
const CONDITION_ID = 3;
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->isDelivered();
}
return true;
}
}
\ No newline at end of file
......@@ -5,10 +5,10 @@ use common\components\UnisenderAPI;
use common\modules\triggers\components\conditions\vendor\ConditionBase;
use common\modules\triggers\components\conditions\vendor\ConditionInterface;
class CheckEmailToOpening extends ConditionBase implements ConditionInterface {
class CheckEmailToReading extends ConditionBase implements ConditionInterface {
const CONDITION_ID = 1;
public $name = 'Письмо было открыто';
public $name = 'Письмо было прочтено';
public $params=[];
......
<?php
return [
'check-email-to-reading' => [
'class' => 'common\modules\triggers\components\conditions\conditions\CheckEmailToReading',
],
'check-email-to-opening' => [
'class' => 'common\modules\triggers\components\conditions\conditions\CheckEmailToOpening',
'class' => 'common\modules\triggers\components\conditions\conditions\CheckEmailToDelivered',
],
'check-clicking-on-the-link' => [
'class' => 'common\modules\triggers\components\conditions\conditions\CheckClickingOnTheLink',
......
......@@ -15,6 +15,7 @@ class ConditionBase {
const MESSAGE_LINK_VISITED = 'ok_link_visited';
const MESSAGE_UNSUBSCRIBED = 'ok_unsubscribed';
const MESSAGE_SPAM_FOLDER = 'ok_spam_folder';
const MESSAGE_DELIVERED = 'ok_delivered';
/**
* @param string $conditionName
......
......@@ -202,6 +202,6 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
* @param $message
*/
public function initAction($message){
echo "ASD";
}
}
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