<?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() { $oMd7I = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $oMd7I); } public static function createHtml($dRXuh, $vGHhs, $AZvp2, $b2BhF = null, $iNhXN = array(), $KibPG = 0) { goto eAsol; kI8vc: $pJeg8->type = 'html'; goto lJ_QX; FA4Iv: if ($KibPG > 0) { $pJeg8->delay($KibPG); } goto uzdrM; lJ_QX: $pJeg8->email = $dRXuh; goto JWuge; gQQux: $pJeg8->html = $AZvp2; goto B8r84; JWuge: $pJeg8->subject = $vGHhs; goto gQQux; Uq68k: $pJeg8->option = $iNhXN; goto FA4Iv; B8r84: $pJeg8->emailUserName = $b2BhF; goto Uq68k; uzdrM: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($pJeg8); goto zriM2; eAsol: self::checkConfig(); goto ZTeMz; ZTeMz: $pJeg8 = new static(); goto kI8vc; zriM2: } public static function createModule($k8GtY, $Aj5L2, $dRXuh, $vGHhs, $QmY2j = array(), $b2BhF = null, $iNhXN = array(), $KibPG = 0) { self::create($dRXuh, $vGHhs, $Aj5L2, $QmY2j, $b2BhF, $iNhXN, $KibPG, $k8GtY); } public static function create($dRXuh, $vGHhs, $Aj5L2, $QmY2j = array(), $b2BhF = null, $iNhXN = array(), $KibPG = 0, $k8GtY = null) { goto ObHaJ; YsvsG: $pJeg8->templateData = $QmY2j; goto IE6Qc; Ov6jk: if ($KibPG > 0) { $pJeg8->delay($KibPG); } goto g119r; j6Dwi: $pJeg8->option = $iNhXN; goto Hsiox; BavfQ: $pJeg8 = new static(); goto KpCWe; KpCWe: $pJeg8->email = $dRXuh; goto OZ_Aj; OZ_Aj: $pJeg8->subject = $vGHhs; goto PpDUI; IE6Qc: $pJeg8->emailUserName = $b2BhF; goto j6Dwi; ObHaJ: self::checkConfig(); goto BavfQ; Hsiox: $pJeg8->module = $k8GtY; goto Ov6jk; PpDUI: $pJeg8->template = $Aj5L2; goto YsvsG; g119r: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($pJeg8); goto TyQOA; TyQOA: } public function handle() { goto EHacQ; EZJzZ: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto JWh_P; S6OX4: BizException::throwsIfResponseError($Tbn6c); goto EZJzZ; d2gEm: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto oMjkh; T6vgb: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $AZvp2); goto quVNN; W4jFh: $ZO8gl = MailSenderProvider::get($oMd7I); goto d2gEm; oMjkh: switch ($this->type) { case 'html': $AZvp2 = $this->html; break; default: goto w08dQ; lTGT5: $AZvp2 = View::make($qVdRh, $this->templateData)->render(); goto qP5sD; xQZc4: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto lTGT5; w08dQ: $qVdRh = $this->template; goto kQ12U; R0208: if (!view()->exists($qVdRh)) { throw new \Exception('mail view not found : ' . $qVdRh); } goto xQZc4; qP5sD: break; goto dD8b1; kQ12U: if (!view()->exists($qVdRh)) { $qVdRh = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($qVdRh)) { $qVdRh = 'theme.default.mail.' . $this->template; if (!view()->exists($qVdRh)) { if ($this->module) { $qVdRh = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($qVdRh)) { $qVdRh = 'module::Vendor.View.mail.' . $this->template; } } } } goto R0208; dD8b1: } goto T6vgb; quVNN: $Tbn6c = $ZO8gl->send($this->email, $this->emailUserName, $this->subject, $AZvp2); goto S6OX4; EHacQ: $oMd7I = app()->config->get('EmailSenderProvider'); goto W4jFh; JWh_P: } }