- Добавлена замена параметра user_fio

parent c3006379
...@@ -214,6 +214,8 @@ class TriggerTrigger extends \common\components\ActiveRecordModel ...@@ -214,6 +214,8 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
* @return string * @return string
*/ */
public function initAction($params=array()){ public function initAction($params=array()){
$templateData = [];
if (array_key_exists('email', $params)) if (array_key_exists('email', $params))
$email = $params['email']; $email = $params['email'];
elseif(empty($email) && !Yii::$app->user->isGuest) { elseif(empty($email) && !Yii::$app->user->isGuest) {
...@@ -222,12 +224,19 @@ class TriggerTrigger extends \common\components\ActiveRecordModel ...@@ -222,12 +224,19 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
return 'Email not found'; return 'Email not found';
} }
if (isset($email)) {
$user = User::find()->where(['email' => $email])->one();
if (!is_null($user)) {
$templateData['user_fio'] = $user->fio;
}
}
/** @var \DateTime $time_now */ /** @var \DateTime $time_now */
$time_now=new \DateTime(); $time_now=new \DateTime();
/** @var MessageTemplate $templateModel */ /** @var MessageTemplate $templateModel */
$templateModel = MessageTemplate::findOne($this->message_template_id); $templateModel = MessageTemplate::findOne($this->message_template_id);
/** @var Templates $template */ /** @var Templates $template */
$template = new Templates($this->message_template_id); $template = new Templates($this->message_template_id, $templateData);
$sender = new UnisenderAPI(); $sender = new UnisenderAPI();
// Create the send list // Create the send list
$newList = $sender->createList(); $newList = $sender->createList();
......
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