<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Job; 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() { $kHDkQ = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $kHDkQ); } public static function createHtml($ynBrC, $WNH3r, $S_vgw, $m41TW = null, $f2U49 = array(), $W3L1K = 0) { goto pr05O; bEepT: $bicx_->html = $S_vgw; goto pPFiL; IgjXD: $bicx_->subject = $WNH3r; goto bEepT; SCUnU: $bicx_->option = $f2U49; goto qZYfW; qZYfW: if ($W3L1K > 0) { $bicx_->delay($W3L1K); } goto qWDBB; QlQ4c: $bicx_->type = 'html'; goto Fzn3K; pPFiL: $bicx_->emailUserName = $m41TW; goto SCUnU; U4RPG: $bicx_ = new static(); goto QlQ4c; pr05O: self::checkConfig(); goto U4RPG; Fzn3K: $bicx_->email = $ynBrC; goto IgjXD; qWDBB: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($bicx_); goto XQ6ay; XQ6ay: } public static function createModule($FgH5V, $np9vN, $ynBrC, $WNH3r, $DlEFb = array(), $m41TW = null, $f2U49 = array(), $W3L1K = 0) { self::create($ynBrC, $WNH3r, $np9vN, $DlEFb, $m41TW, $f2U49, $W3L1K, $FgH5V); } public static function create($ynBrC, $WNH3r, $np9vN, $DlEFb = array(), $m41TW = null, $f2U49 = array(), $W3L1K = 0, $FgH5V = null) { goto VCj75; gcLSk: $bicx_->email = $ynBrC; goto GkGyJ; KOi5o: $bicx_->module = $FgH5V; goto th5mU; I_xRT: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($bicx_); goto zKRR1; GkGyJ: $bicx_->subject = $WNH3r; goto UUE0Y; cUOWv: $bicx_->option = $f2U49; goto KOi5o; UUE0Y: $bicx_->template = $np9vN; goto utI6b; utI6b: $bicx_->templateData = $DlEFb; goto Lw8kj; th5mU: if ($W3L1K > 0) { $bicx_->delay($W3L1K); } goto I_xRT; KTe1L: $bicx_ = new static(); goto gcLSk; Lw8kj: $bicx_->emailUserName = $m41TW; goto cUOWv; VCj75: self::checkConfig(); goto KTe1L; zKRR1: } public function handle() { goto b7jk3; b7jk3: $kHDkQ = app()->config->get('EmailSenderProvider'); goto ul_1u; k_l_m: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto LJ0hz; hoZEH: switch ($this->type) { case 'html': $S_vgw = $this->html; break; default: goto wd7lH; LOWo0: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto M303S; u1zu_: if (!view()->exists($faKDa)) { throw new \Exception('mail view not found : ' . $faKDa); } goto LOWo0; M303S: $S_vgw = View::make($faKDa, $this->templateData)->render(); goto AXPwW; nAu1q: if (!view()->exists($faKDa)) { $faKDa = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($faKDa)) { $faKDa = 'theme.default.mail.' . $this->template; if (!view()->exists($faKDa)) { if ($this->module) { $faKDa = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($faKDa)) { $faKDa = 'module::Vendor.View.mail.' . $this->template; } } } } goto u1zu_; AXPwW: break; goto PWHMO; wd7lH: $faKDa = $this->template; goto nAu1q; PWHMO: } goto N0pFL; ul_1u: $CGEHS = MailSenderProvider::get($kHDkQ); goto kAErf; kAErf: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto hoZEH; moEkT: $ZrjxR = $CGEHS->send($this->email, $this->emailUserName, $this->subject, $S_vgw); goto s9JKN; s9JKN: BizException::throwsIfResponseError($ZrjxR); goto k_l_m; N0pFL: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $S_vgw); goto moEkT; LJ0hz: } }