- Доработан метод инициации действия

parent d5b3a5b2
......@@ -210,17 +210,23 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
/**
* Тут выполняем то, что произойдет когда триггер сработает
*
* @param null $message
* @param array $params
* @return string
*/
public function initAction($message=null){
public function initAction($params=array()){
$email = (!Yii::$app->user->isGuest) ? Yii::$app->user->identity->email : null;
if ($email===null && array_key_exists('email', $params))
$email = $params['email'];
else
return 'Email not found';
/** @var \DateTime $time_now */
$time_now=new \DateTime();
/** @var MessageTemplate $templateModel */
$templateModel = MessageTemplate::findOne($this->message_template_id);
/** @var Templates $template */
$template = new Templates($this->message_template_id);
$email = Yii::$app->user->identity->email;
$email = $email;
$sender = new UnisenderAPI();
// Create the send list
$newList = $sender->createList();
......@@ -256,7 +262,7 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
if ($schedule->save()) {
return true;
} else {
return current(current($schedule->getErrors()));
return (current(current($schedule->getErrors())));
}
} else {
$error = (array_key_exists('error', $newCampaignObject)) ? $newCampaignObject['error'] : 'Неизвестная ошибка (CreateCampaign)';
......
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