<?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() { $pXrNS = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $pXrNS); } public static function createHtml($ber3G, $UFLoy, $FpbVq, $oVg5w = null, $LAk9h = array(), $FgaY_ = 0) { goto d2RZo; c_H4Q: $jm4we = new static(); goto ONeba; jnPdS: $jm4we->email = $ber3G; goto uWLtf; WCF_h: $jm4we->html = $FpbVq; goto UDKgg; o_ERD: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($jm4we); goto ILtJF; ONeba: $jm4we->type = 'html'; goto jnPdS; d2RZo: self::checkConfig(); goto c_H4Q; BOZvW: $jm4we->option = $LAk9h; goto VCIkw; UDKgg: $jm4we->emailUserName = $oVg5w; goto BOZvW; uWLtf: $jm4we->subject = $UFLoy; goto WCF_h; VCIkw: if ($FgaY_ > 0) { $jm4we->delay($FgaY_); } goto o_ERD; ILtJF: } public static function createModule($z_J2N, $eMuYk, $ber3G, $UFLoy, $EIJx6 = array(), $oVg5w = null, $LAk9h = array(), $FgaY_ = 0) { self::create($ber3G, $UFLoy, $eMuYk, $EIJx6, $oVg5w, $LAk9h, $FgaY_, $z_J2N); } public static function create($ber3G, $UFLoy, $eMuYk, $EIJx6 = array(), $oVg5w = null, $LAk9h = array(), $FgaY_ = 0, $z_J2N = null) { goto rNr8o; wPKWx: $jm4we->emailUserName = $oVg5w; goto LJyzE; eyuXi: $jm4we->subject = $UFLoy; goto eoCSe; eoCSe: $jm4we->template = $eMuYk; goto uiuzi; uiuzi: $jm4we->templateData = $EIJx6; goto wPKWx; CUwc8: if ($FgaY_ > 0) { $jm4we->delay($FgaY_); } goto s8FMJ; oAWft: $jm4we->module = $z_J2N; goto CUwc8; PCcGF: $jm4we->email = $ber3G; goto eyuXi; LJyzE: $jm4we->option = $LAk9h; goto oAWft; s8FMJ: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($jm4we); goto nyHGX; rNr8o: self::checkConfig(); goto yFNgB; yFNgB: $jm4we = new static(); goto PCcGF; nyHGX: } public function handle() { goto BpgoS; BpgoS: $pXrNS = app()->config->get('EmailSenderProvider'); goto jSphr; uJpqR: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto TkFWh; PPZLU: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto ZM19s; qpzC4: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $FpbVq); goto irHf1; jSphr: $hKL6P = MailSenderProvider::get($pXrNS); goto PPZLU; x5jnU: BizException::throwsIfResponseError($gMg9x); goto uJpqR; irHf1: $gMg9x = $hKL6P->send($this->email, $this->emailUserName, $this->subject, $FpbVq); goto x5jnU; ZM19s: switch ($this->type) { case 'html': $FpbVq = $this->html; break; default: goto ZXVm7; ZXVm7: $N8SrS = $this->template; goto ZvqIK; Teqja: $FpbVq = View::make($N8SrS, $this->templateData)->render(); goto mOqOT; ZvqIK: if (!view()->exists($N8SrS)) { $N8SrS = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($N8SrS)) { $N8SrS = 'theme.default.mail.' . $this->template; if (!view()->exists($N8SrS)) { if ($this->module) { $N8SrS = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($N8SrS)) { $N8SrS = 'module::Vendor.View.mail.' . $this->template; } } } } goto VfgK_; VfgK_: if (!view()->exists($N8SrS)) { throw new \Exception('mail view not found : ' . $N8SrS); } goto lfRVP; lfRVP: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto Teqja; mOqOT: break; goto iOIsB; iOIsB: } goto qpzC4; TkFWh: } }