diff --git a/Westdc/Authentication/AuthenticationService.php b/Westdc/Authentication/AuthenticationService.php index 9818577..9bf780e 100644 --- a/Westdc/Authentication/AuthenticationService.php +++ b/Westdc/Authentication/AuthenticationService.php @@ -41,6 +41,11 @@ class AuthenticationService $namespace = $e->getRouteMatch()->getParam('__NAMESPACE__'); $controller = $e->getRouteMatch()->getParam('controller'); $action = $e->getRouteMatch()->getParam('action'); + + if($module == 'Engine' && $namespace == 'ConsoleApp') + { + return true; + } // view::Dump($e->getRouteMatch()->getMatchedRouteName() . ":" . $controller."-".$action,false); diff --git a/Westdc/Mail/Mail.php b/Westdc/Mail/Mail.php index 32fadd4..eeb7cf4 100644 --- a/Westdc/Mail/Mail.php +++ b/Westdc/Mail/Mail.php @@ -31,6 +31,7 @@ class Mail extends AbstractEventManager implements ServiceManagerAwareInterface{ public $body; public $type; public $transport; + public $from; public function setServiceManager(ServiceManager $serviceManager) { @@ -101,7 +102,7 @@ class Mail extends AbstractEventManager implements ServiceManagerAwareInterface{ } //设置默认发件人 - public function setDefaultForm() + public function setDefaultFrom() { $this->mail->setFrom($this->config['smtp']['username'],$this->config['smtp']['name']); } @@ -125,6 +126,14 @@ class Mail extends AbstractEventManager implements ServiceManagerAwareInterface{ }//加载模板 + /** + * @param $from + */ + public function setFrom($from) + { + $this->from = $from; + } + //使用loadTemplate 的结果发送邮件 //在此之前需要使用 $this->mail->addTo()添加收件人 public function send($from = NULL){ @@ -148,11 +157,14 @@ class Mail extends AbstractEventManager implements ServiceManagerAwareInterface{ $this->mail->setBody($this->body); } - if(empty($from)) + if(empty($from) && empty($this->from)) { - $this->setDefaultForm(); + $this->setDefaultFrom(); }else{ - $this->mail->setFrom($from['email'],$from['name']); + if(!empty($this->from)) + $this->mail->setFrom($this->from['email'],$this->from['name']); + if(!empty($from)) + $this->mail->setFrom($from['email'],$from['name']); } $this->mail->setSubject($this->subject); diff --git a/Westdc/Mail/Template.php b/Westdc/Mail/Template.php index a590101..32984e0 100644 --- a/Westdc/Mail/Template.php +++ b/Westdc/Mail/Template.php @@ -106,6 +106,13 @@ class Template implements ServiceManagerAwareInterface $template_data = $this->fetch($key); + if(empty($data) || !is_array($data) || count($data) < 1) + return [ + 'subject' => $template_data['subject'], + 'body' => $template_data['body'], + 'type' => isset($template_data['type']) ? $template_data['type'] : self::DEFAULT_TEMPLATE_TYPE + ]; + $patterns = array(); $replacements = array();