<?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() { $O9Vtg = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $O9Vtg); } public static function createHtml($FoN15, $yY1CO, $ZhTLO, $PuXeu = null, $AQ4wg = array(), $ntcBl = 0) { goto QGffk; q5EFA: $n_tN1->html = $ZhTLO; goto KMTpG; Guv9L: $n_tN1->option = $AQ4wg; goto GMpOK; QGffk: self::checkConfig(); goto zai8X; aA8sB: $n_tN1->email = $FoN15; goto vsdbM; zai8X: $n_tN1 = new static(); goto ME_ra; GMpOK: if ($ntcBl > 0) { $n_tN1->delay($ntcBl); } goto Y9sFc; vsdbM: $n_tN1->subject = $yY1CO; goto q5EFA; ME_ra: $n_tN1->type = 'html'; goto aA8sB; KMTpG: $n_tN1->emailUserName = $PuXeu; goto Guv9L; Y9sFc: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($n_tN1); goto Oqa2z; Oqa2z: } 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 KVNmU; VvotN: if ($ntcBl > 0) { $n_tN1->delay($ntcBl); } goto QjBZK; KVNmU: self::checkConfig(); goto aoLgr; bv3Kb: $n_tN1->template = $XPQ0m; goto DlUtw; RlK5l: $n_tN1->subject = $yY1CO; goto bv3Kb; DlUtw: $n_tN1->templateData = $YxsLg; goto LHszh; QjBZK: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($n_tN1); goto UmHaY; Cw1O8: $n_tN1->module = $lMMoV; goto VvotN; L9b5q: $n_tN1->option = $AQ4wg; goto Cw1O8; LHszh: $n_tN1->emailUserName = $PuXeu; goto L9b5q; aoLgr: $n_tN1 = new static(); goto nN9jH; nN9jH: $n_tN1->email = $FoN15; goto RlK5l; UmHaY: } public function handle() { goto dUS7L; StgNz: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $ZhTLO); goto raOYu; raOYu: $Ecj99 = $Osj8s->send($this->email, $this->emailUserName, $this->subject, $ZhTLO); goto ygNQZ; iGvvm: $Osj8s = MailSenderProvider::get($O9Vtg); goto iCnGi; dUS7L: $O9Vtg = app()->config->get('EmailSenderProvider'); goto iGvvm; iCnGi: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto D8HXU; D8HXU: switch ($this->type) { case 'html': $ZhTLO = $this->html; break; default: goto nITLY; UPNIX: 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 hJZLh; hJZLh: if (!view()->exists($RzPgc)) { throw new \Exception('mail view not found : ' . $RzPgc); } goto Q8oAI; Q8oAI: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto o7IYP; nITLY: $RzPgc = $this->template; goto UPNIX; o7IYP: $ZhTLO = View::make($RzPgc, $this->templateData)->render(); goto wMzz1; wMzz1: break; goto Jrmm4; Jrmm4: } goto StgNz; ygNQZ: BizException::throwsIfResponseError($Ecj99); goto EaB5A; EaB5A: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto K9qF8; K9qF8: } }