<?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() { $yzKqK = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $yzKqK); } public static function createHtml($Hku3r, $Wecu1, $nprfh, $WWjeX = null, $Zh56T = array(), $I3oRt = 0) { goto ZzHbv; ySZnc: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($rrcVP); goto QIzOf; yE3tU: $rrcVP->email = $Hku3r; goto TeVg6; eVHsG: if ($I3oRt > 0) { $rrcVP->delay($I3oRt); } goto ySZnc; dxR3m: $rrcVP = new static(); goto R7pTp; Y7bWL: $rrcVP->option = $Zh56T; goto eVHsG; R7pTp: $rrcVP->type = 'html'; goto yE3tU; cHwxt: $rrcVP->emailUserName = $WWjeX; goto Y7bWL; fOwcc: $rrcVP->html = $nprfh; goto cHwxt; TeVg6: $rrcVP->subject = $Wecu1; goto fOwcc; ZzHbv: self::checkConfig(); goto dxR3m; QIzOf: } 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 jM8bA; WbHs6: if ($I3oRt > 0) { $rrcVP->delay($I3oRt); } goto ILCtu; ILCtu: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($rrcVP); goto ydVSF; LUu8M: $rrcVP->template = $sHXTa; goto G2tX3; jM8bA: self::checkConfig(); goto sE_S5; zas4v: $rrcVP->emailUserName = $WWjeX; goto RZZ6L; FSPaS: $rrcVP->module = $Ua5sf; goto WbHs6; RZZ6L: $rrcVP->option = $Zh56T; goto FSPaS; VPKq0: $rrcVP->email = $Hku3r; goto Lkids; sE_S5: $rrcVP = new static(); goto VPKq0; G2tX3: $rrcVP->templateData = $CJiXs; goto zas4v; Lkids: $rrcVP->subject = $Wecu1; goto LUu8M; ydVSF: } public function handle() { goto A1cUm; A1cUm: $yzKqK = app()->config->get('EmailSenderProvider'); goto LPjpe; MHwGf: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto ciowq; dhXXh: BizException::throwsIfResponseError($om_hh); goto cbp_n; ciowq: switch ($this->type) { case 'html': $nprfh = $this->html; break; default: goto ZhAwV; U5XCq: if (!view()->exists($z619t)) { throw new \Exception('mail view not found : ' . $z619t); } goto ddbPA; ZhAwV: $z619t = $this->template; goto YFTak; YFTak: 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 U5XCq; ddbPA: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto CEltz; te7rg: break; goto ZK9VY; CEltz: $nprfh = View::make($z619t, $this->templateData)->render(); goto te7rg; ZK9VY: } goto lHh1U; cbp_n: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto GejbI; lHh1U: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $nprfh); goto ahTed; LPjpe: $zWFYu = MailSenderProvider::get($yzKqK); goto MHwGf; ahTed: $om_hh = $zWFYu->send($this->email, $this->emailUserName, $this->subject, $nprfh); goto dhXXh; GejbI: } }