<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Email; use Illuminate\Support\Facades\View; use ModStart\Core\Exception\BizException; use ModStart\Core\Job\BaseJob; use Module\Vendor\Log\Logger; use Module\Vendor\Provider\MailSender\AbstractMailSenderProvider; use Module\Vendor\Provider\MailSender\MailSenderProvider; class MailSendJob extends BaseJob { public $email; public $subject; public $template; public $templateData = array(); public $emailUserName = null; public $option = array(); public $module; public $html; public $type; private static function checkConfig() { $O9Vtg = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $O9Vtg); } public static function createHtml($FoN15, $yY1CO, $ZhTLO, $PuXeu = null, $AQ4wg = array(), $ntcBl = 0) { goto PT_cj; PT_cj: self::checkConfig(); goto nzMqN; wBwOj: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($n_tN1); goto hAkZT; a921t: $n_tN1->subject = $yY1CO; goto pqUky; lGMH7: if ($ntcBl > 0) { $n_tN1->delay($ntcBl); } goto wBwOj; sXOyt: $n_tN1->email = $FoN15; goto a921t; nzMqN: $n_tN1 = new static(); goto nGrtv; K4_0y: $n_tN1->emailUserName = $PuXeu; goto Vcvmp; Vcvmp: $n_tN1->option = $AQ4wg; goto lGMH7; pqUky: $n_tN1->html = $ZhTLO; goto K4_0y; nGrtv: $n_tN1->type = 'html'; goto sXOyt; hAkZT: } public static function createModule($lMMoV, $XPQ0m, $FoN15, $yY1CO, $YxsLg = array(), $PuXeu = null, $AQ4wg = array(), $ntcBl = 0) { self::create($FoN15, $yY1CO, $XPQ0m, $YxsLg, $PuXeu, $AQ4wg, $ntcBl, $lMMoV); } public static function create($FoN15, $yY1CO, $XPQ0m, $YxsLg = array(), $PuXeu = null, $AQ4wg = array(), $ntcBl = 0, $lMMoV = null) { goto CLpff; CLpff: self::checkConfig(); goto bKHNx; JgVQI: $n_tN1->option = $AQ4wg; goto hQ2zv; hQ2zv: $n_tN1->module = $lMMoV; goto MhBRj; bKHNx: $n_tN1 = new static(); goto Hbb1F; jxdFE: $n_tN1->template = $XPQ0m; goto jobpl; jvNaj: $n_tN1->emailUserName = $PuXeu; goto JgVQI; u0FiQ: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($n_tN1); goto ctO3W; MhBRj: if ($ntcBl > 0) { $n_tN1->delay($ntcBl); } goto u0FiQ; Qn5ID: $n_tN1->subject = $yY1CO; goto jxdFE; jobpl: $n_tN1->templateData = $YxsLg; goto jvNaj; Hbb1F: $n_tN1->email = $FoN15; goto Qn5ID; ctO3W: } public function handle() { goto cRylT; Zt0Zp: $Osj8s = MailSenderProvider::get($O9Vtg); goto IghkV; dqay4: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto brod2; VHfth: BizException::throwsIfResponseError($Ecj99); goto dqay4; th24F: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $ZhTLO); goto y6IdI; cRylT: $O9Vtg = app()->config->get('EmailSenderProvider'); goto Zt0Zp; y6IdI: $Ecj99 = $Osj8s->send($this->email, $this->emailUserName, $this->subject, $ZhTLO); goto VHfth; NBn75: switch ($this->type) { case 'html': $ZhTLO = $this->html; break; default: goto yJtXK; S2vnX: $ZhTLO = View::make($RzPgc, $this->templateData)->render(); goto zwErS; YaxjZ: if (!view()->exists($RzPgc)) { $RzPgc = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($RzPgc)) { $RzPgc = 'theme.default.mail.' . $this->template; if (!view()->exists($RzPgc)) { if ($this->module) { $RzPgc = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($RzPgc)) { $RzPgc = 'module::Vendor.View.mail.' . $this->template; } } } } goto JhxlZ; ZHPYs: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto S2vnX; zwErS: break; goto bBt0T; JhxlZ: if (!view()->exists($RzPgc)) { throw new \Exception('mail view not found : ' . $RzPgc); } goto ZHPYs; yJtXK: $RzPgc = $this->template; goto YaxjZ; bBt0T: } goto th24F; IghkV: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto NBn75; brod2: } }