<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Job; 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 TzaZE; j_f9h: $owZYb->email = $ww4tY; goto Uf5y1; A1hJu: $owZYb->option = $r2pbP; goto RIsE5; gYLi5: $owZYb->type = 'html'; goto j_f9h; TzaZE: self::checkConfig(); goto F8o39; F8o39: $owZYb = new static(); goto gYLi5; Uf5y1: $owZYb->subject = $UIspZ; goto CmRNO; zI69K: $owZYb->emailUserName = $Fxyn3; goto A1hJu; CmRNO: $owZYb->html = $bW35T; goto zI69K; l8U_t: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($owZYb); goto Jyk1w; RIsE5: if ($fr4BE > 0) { $owZYb->delay($fr4BE); } goto l8U_t; Jyk1w: } 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 h5fdT; w6iJr: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($owZYb); goto h6Ay5; di7IQ: $owZYb->email = $ww4tY; goto Z37q6; Hr8Tj: $owZYb->template = $oqfDC; goto b71SB; h5fdT: self::checkConfig(); goto h6g_9; lYwWN: $owZYb->option = $r2pbP; goto RuquN; b71SB: $owZYb->templateData = $nwAwA; goto kgZgD; Z37q6: $owZYb->subject = $UIspZ; goto Hr8Tj; pL7CV: if ($fr4BE > 0) { $owZYb->delay($fr4BE); } goto w6iJr; h6g_9: $owZYb = new static(); goto di7IQ; kgZgD: $owZYb->emailUserName = $Fxyn3; goto lYwWN; RuquN: $owZYb->module = $ltDK0; goto pL7CV; h6Ay5: } public function handle() { goto xN93Z; LhndM: $zgLsz = MailSenderProvider::get($tDnAb); goto XynUP; xN93Z: $tDnAb = app()->config->get('EmailSenderProvider'); goto LhndM; XynUP: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto rgavQ; rgavQ: switch ($this->type) { case 'html': $bW35T = $this->html; break; default: goto dS65t; FsFjl: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto PnrL5; NqViP: break; goto gLy8g; PnrL5: $bW35T = View::make($kF488, $this->templateData)->render(); goto NqViP; wMniD: if (!view()->exists($kF488)) { throw new \Exception('mail view not found : ' . $kF488); } goto FsFjl; dS65t: $kF488 = $this->template; goto QYBST; QYBST: 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 wMniD; gLy8g: } goto tmYfI; QR65t: $rhLXE = $zgLsz->send($this->email, $this->emailUserName, $this->subject, $bW35T); goto QW4dv; tmYfI: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $bW35T); goto QR65t; QW4dv: BizException::throwsIfResponseError($rhLXE); goto CrOAf; CrOAf: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto sTt94; sTt94: } }