<?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() { $yzKqK = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $yzKqK); } public static function createHtml($Hku3r, $Wecu1, $nprfh, $WWjeX = null, $Zh56T = array(), $I3oRt = 0) { goto Mg5Mr; PFOct: $rrcVP->email = $Hku3r; goto OTr2W; c1bi3: $rrcVP = new static(); goto Hm9uG; Mg5Mr: self::checkConfig(); goto c1bi3; MZ2TN: $rrcVP->option = $Zh56T; goto HPl20; HPl20: if ($I3oRt > 0) { $rrcVP->delay($I3oRt); } goto r1lXS; Zlw41: $rrcVP->emailUserName = $WWjeX; goto MZ2TN; OTr2W: $rrcVP->subject = $Wecu1; goto h4Kys; Hm9uG: $rrcVP->type = 'html'; goto PFOct; r1lXS: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($rrcVP); goto hmv27; h4Kys: $rrcVP->html = $nprfh; goto Zlw41; hmv27: } public static function createModule($Ua5sf, $sHXTa, $Hku3r, $Wecu1, $CJiXs = array(), $WWjeX = null, $Zh56T = array(), $I3oRt = 0) { self::create($Hku3r, $Wecu1, $sHXTa, $CJiXs, $WWjeX, $Zh56T, $I3oRt, $Ua5sf); } public static function create($Hku3r, $Wecu1, $sHXTa, $CJiXs = array(), $WWjeX = null, $Zh56T = array(), $I3oRt = 0, $Ua5sf = null) { goto K_wWE; cD6IY: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($rrcVP); goto qcg2_; eayUC: $rrcVP->emailUserName = $WWjeX; goto UNTKp; K_wWE: self::checkConfig(); goto wnLx5; lg5PE: $rrcVP->module = $Ua5sf; goto JR7bo; UNTKp: $rrcVP->option = $Zh56T; goto lg5PE; wnLx5: $rrcVP = new static(); goto ZXsMz; oR8ma: $rrcVP->template = $sHXTa; goto qopq9; qopq9: $rrcVP->templateData = $CJiXs; goto eayUC; ZXsMz: $rrcVP->email = $Hku3r; goto DxayF; JR7bo: if ($I3oRt > 0) { $rrcVP->delay($I3oRt); } goto cD6IY; DxayF: $rrcVP->subject = $Wecu1; goto oR8ma; qcg2_: } public function handle() { goto ULg4m; ULg4m: $yzKqK = app()->config->get('EmailSenderProvider'); goto jcnrr; SZqVz: switch ($this->type) { case 'html': $nprfh = $this->html; break; default: goto L30Ak; G2dez: $nprfh = View::make($z619t, $this->templateData)->render(); goto l3ikP; L30Ak: $z619t = $this->template; goto qrE2H; vijSA: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto G2dez; PkM1L: if (!view()->exists($z619t)) { throw new \Exception('mail view not found : ' . $z619t); } goto vijSA; qrE2H: if (!view()->exists($z619t)) { $z619t = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($z619t)) { $z619t = 'theme.default.mail.' . $this->template; if (!view()->exists($z619t)) { if ($this->module) { $z619t = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($z619t)) { $z619t = 'module::Vendor.View.mail.' . $this->template; } } } } goto PkM1L; l3ikP: break; goto OTvW2; OTvW2: } goto aGDyD; jcnrr: $zWFYu = MailSenderProvider::get($yzKqK); goto nqOqR; aGDyD: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $nprfh); goto dIDi_; NTMdk: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto Kh0t3; dIDi_: $om_hh = $zWFYu->send($this->email, $this->emailUserName, $this->subject, $nprfh); goto hBprz; hBprz: BizException::throwsIfResponseError($om_hh); goto NTMdk; nqOqR: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto SZqVz; Kh0t3: } }