<?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() { $ugwYT = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $ugwYT); } public static function createHtml($ONQv_, $K1Sxp, $eiHAU, $Hfsw7 = null, $wCJen = array(), $DV2vc = 0) { goto ElOeO; ElOeO: self::checkConfig(); goto fhspA; tldRr: $ZnNP5->subject = $K1Sxp; goto A31Zx; XTs3L: $ZnNP5->email = $ONQv_; goto tldRr; T9tCO: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($ZnNP5); goto xCv6q; DJ4v2: $ZnNP5->type = 'html'; goto XTs3L; fhspA: $ZnNP5 = new static(); goto DJ4v2; A31Zx: $ZnNP5->html = $eiHAU; goto iEVIh; iEVIh: $ZnNP5->emailUserName = $Hfsw7; goto GCi4d; GCi4d: $ZnNP5->option = $wCJen; goto pPrjm; pPrjm: if ($DV2vc > 0) { $ZnNP5->delay($DV2vc); } goto T9tCO; xCv6q: } public static function createModule($LLvXr, $IulMt, $ONQv_, $K1Sxp, $AIfUa = array(), $Hfsw7 = null, $wCJen = array(), $DV2vc = 0) { self::create($ONQv_, $K1Sxp, $IulMt, $AIfUa, $Hfsw7, $wCJen, $DV2vc, $LLvXr); } public static function create($ONQv_, $K1Sxp, $IulMt, $AIfUa = array(), $Hfsw7 = null, $wCJen = array(), $DV2vc = 0, $LLvXr = null) { goto hTfte; V8iNU: $ZnNP5->template = $IulMt; goto sKCLd; sKCLd: $ZnNP5->templateData = $AIfUa; goto gd52G; GKUTQ: if ($DV2vc > 0) { $ZnNP5->delay($DV2vc); } goto MOgfM; hpxpW: $ZnNP5 = new static(); goto iHeOU; MOgfM: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($ZnNP5); goto nI6bm; pLlz0: $ZnNP5->subject = $K1Sxp; goto V8iNU; QwNTM: $ZnNP5->module = $LLvXr; goto GKUTQ; hjRAW: $ZnNP5->option = $wCJen; goto QwNTM; gd52G: $ZnNP5->emailUserName = $Hfsw7; goto hjRAW; iHeOU: $ZnNP5->email = $ONQv_; goto pLlz0; hTfte: self::checkConfig(); goto hpxpW; nI6bm: } public function handle() { goto Ldp0U; Ldp0U: $ugwYT = app()->config->get('EmailSenderProvider'); goto SO4V1; qqvJG: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto hYjNg; WZWWZ: $yCUD1 = $vFZTy->send($this->email, $this->emailUserName, $this->subject, $eiHAU); goto zb5VZ; TjKzx: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto HQamy; zb5VZ: BizException::throwsIfResponseError($yCUD1); goto TjKzx; sOgm4: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $eiHAU); goto WZWWZ; SO4V1: $vFZTy = MailSenderProvider::get($ugwYT); goto qqvJG; hYjNg: switch ($this->type) { case 'html': $eiHAU = $this->html; break; default: goto v8Mm0; v8Mm0: $RiwEA = $this->template; goto MFxOL; rIX4P: if (!view()->exists($RiwEA)) { throw new \Exception('mail view not found : ' . $RiwEA); } goto wh7fH; p6nMY: $eiHAU = View::make($RiwEA, $this->templateData)->render(); goto HOhF6; MFxOL: if (!view()->exists($RiwEA)) { $RiwEA = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($RiwEA)) { $RiwEA = 'theme.default.mail.' . $this->template; if (!view()->exists($RiwEA)) { if ($this->module) { $RiwEA = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($RiwEA)) { $RiwEA = 'module::Vendor.View.mail.' . $this->template; } } } } goto rIX4P; wh7fH: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto p6nMY; HOhF6: break; goto ciEim; ciEim: } goto sOgm4; HQamy: } }