<?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() { $sefXk = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $sefXk); } public static function createHtml($c6i2z, $xcAHX, $yPdr6, $LnjH9 = null, $It5Ki = array(), $uxhjq = 0) { goto IrVDc; x9TfP: $QJc0N->subject = $xcAHX; goto I79vL; ORYVd: $QJc0N->type = 'html'; goto Vy79S; ZQa6j: $QJc0N = new static(); goto ORYVd; LIdsb: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($QJc0N); goto Zb0n0; I79vL: $QJc0N->html = $yPdr6; goto B38qj; B38qj: $QJc0N->emailUserName = $LnjH9; goto twcK3; twcK3: $QJc0N->option = $It5Ki; goto UVfIo; UVfIo: if ($uxhjq > 0) { $QJc0N->delay($uxhjq); } goto LIdsb; IrVDc: self::checkConfig(); goto ZQa6j; Vy79S: $QJc0N->email = $c6i2z; goto x9TfP; Zb0n0: } public static function createModule($WQ9HU, $H09n_, $c6i2z, $xcAHX, $JKXDQ = array(), $LnjH9 = null, $It5Ki = array(), $uxhjq = 0) { self::create($c6i2z, $xcAHX, $H09n_, $JKXDQ, $LnjH9, $It5Ki, $uxhjq, $WQ9HU); } public static function create($c6i2z, $xcAHX, $H09n_, $JKXDQ = array(), $LnjH9 = null, $It5Ki = array(), $uxhjq = 0, $WQ9HU = null) { goto WRavX; XPPKg: if ($uxhjq > 0) { $QJc0N->delay($uxhjq); } goto tP1wm; b98fd: $QJc0N = new static(); goto GsaVM; GsaVM: $QJc0N->email = $c6i2z; goto dW8AD; EMTGz: $QJc0N->option = $It5Ki; goto fZ_Bw; fZ_Bw: $QJc0N->module = $WQ9HU; goto XPPKg; pguOO: $QJc0N->emailUserName = $LnjH9; goto EMTGz; WRavX: self::checkConfig(); goto b98fd; dW8AD: $QJc0N->subject = $xcAHX; goto pVKe7; pVKe7: $QJc0N->template = $H09n_; goto rUZGv; tP1wm: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($QJc0N); goto LFB4B; rUZGv: $QJc0N->templateData = $JKXDQ; goto pguOO; LFB4B: } public function handle() { goto PQs7V; DQ3ss: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto n2TIL; HT7OT: $Gs3Xd = $QCsX1->send($this->email, $this->emailUserName, $this->subject, $yPdr6); goto uLBPp; uLBPp: BizException::throwsIfResponseError($Gs3Xd); goto DQ3ss; AhxNE: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto t0KqZ; WxwfT: $QCsX1 = MailSenderProvider::get($sefXk); goto AhxNE; t0KqZ: switch ($this->type) { case 'html': $yPdr6 = $this->html; break; default: goto VEXms; DeQ3M: if (!view()->exists($wFt7y)) { throw new \Exception('mail view not found : ' . $wFt7y); } goto o3Jon; Y2m4x: break; goto mkDTU; o3Jon: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto jtjYm; VEXms: $wFt7y = $this->template; goto gNlHr; jtjYm: $yPdr6 = View::make($wFt7y, $this->templateData)->render(); goto Y2m4x; gNlHr: if (!view()->exists($wFt7y)) { $wFt7y = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($wFt7y)) { $wFt7y = 'theme.default.mail.' . $this->template; if (!view()->exists($wFt7y)) { if ($this->module) { $wFt7y = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($wFt7y)) { $wFt7y = 'module::Vendor.View.mail.' . $this->template; } } } } goto DeQ3M; mkDTU: } goto B1h_m; B1h_m: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $yPdr6); goto HT7OT; PQs7V: $sefXk = app()->config->get('EmailSenderProvider'); goto WxwfT; n2TIL: } }