<?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() { $tDnAb = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $tDnAb); } public static function createHtml($ww4tY, $UIspZ, $bW35T, $Fxyn3 = null, $r2pbP = array(), $fr4BE = 0) { goto Is0yk; MsHuD: $owZYb->option = $r2pbP; goto sGv_d; Tmo40: $owZYb->type = 'html'; goto h6Xjn; UDd8V: $owZYb = new static(); goto Tmo40; wwEQ0: $owZYb->html = $bW35T; goto dQmMP; A6e0D: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($owZYb); goto ysEJV; sGv_d: if ($fr4BE > 0) { $owZYb->delay($fr4BE); } goto A6e0D; h6Xjn: $owZYb->email = $ww4tY; goto gVxaX; gVxaX: $owZYb->subject = $UIspZ; goto wwEQ0; dQmMP: $owZYb->emailUserName = $Fxyn3; goto MsHuD; Is0yk: self::checkConfig(); goto UDd8V; ysEJV: } public static function createModule($ltDK0, $oqfDC, $ww4tY, $UIspZ, $nwAwA = array(), $Fxyn3 = null, $r2pbP = array(), $fr4BE = 0) { self::create($ww4tY, $UIspZ, $oqfDC, $nwAwA, $Fxyn3, $r2pbP, $fr4BE, $ltDK0); } public static function create($ww4tY, $UIspZ, $oqfDC, $nwAwA = array(), $Fxyn3 = null, $r2pbP = array(), $fr4BE = 0, $ltDK0 = null) { goto wvVeP; HKoXY: $owZYb->option = $r2pbP; goto gwjtJ; u0sNv: $owZYb = new static(); goto cY1xB; SsCdN: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($owZYb); goto qKE5r; c8CtB: $owZYb->emailUserName = $Fxyn3; goto HKoXY; wvVeP: self::checkConfig(); goto u0sNv; c2Coq: $owZYb->template = $oqfDC; goto TAcP6; TAcP6: $owZYb->templateData = $nwAwA; goto c8CtB; d9Co6: $owZYb->subject = $UIspZ; goto c2Coq; cY1xB: $owZYb->email = $ww4tY; goto d9Co6; IqTNY: if ($fr4BE > 0) { $owZYb->delay($fr4BE); } goto SsCdN; gwjtJ: $owZYb->module = $ltDK0; goto IqTNY; qKE5r: } public function handle() { goto vHCrZ; ZKpG6: BizException::throwsIfResponseError($rhLXE); goto jHNHa; TA7Vr: $rhLXE = $zgLsz->send($this->email, $this->emailUserName, $this->subject, $bW35T); goto ZKpG6; vHCrZ: $tDnAb = app()->config->get('EmailSenderProvider'); goto fd5KX; jHNHa: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto cxAGy; vcqhu: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto itsIO; itsIO: switch ($this->type) { case 'html': $bW35T = $this->html; break; default: goto SXhcH; S_oSb: break; goto dm4Rf; FQqLV: if (!view()->exists($kF488)) { $kF488 = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($kF488)) { $kF488 = 'theme.default.mail.' . $this->template; if (!view()->exists($kF488)) { if ($this->module) { $kF488 = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($kF488)) { $kF488 = 'module::Vendor.View.mail.' . $this->template; } } } } goto ViIRb; JJD4_: $bW35T = View::make($kF488, $this->templateData)->render(); goto S_oSb; ViIRb: if (!view()->exists($kF488)) { throw new \Exception('mail view not found : ' . $kF488); } goto wX23e; SXhcH: $kF488 = $this->template; goto FQqLV; wX23e: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto JJD4_; dm4Rf: } goto B4V14; fd5KX: $zgLsz = MailSenderProvider::get($tDnAb); goto vcqhu; B4V14: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $bW35T); goto TA7Vr; cxAGy: } }