<?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() { $sefXk = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $sefXk); } public static function createHtml($c6i2z, $xcAHX, $yPdr6, $LnjH9 = null, $It5Ki = array(), $uxhjq = 0) { goto DwgJE; TD84K: $QJc0N = new static(); goto T3fAm; T3fAm: $QJc0N->type = 'html'; goto WsuSt; B1jKO: $QJc0N->html = $yPdr6; goto LTPsr; hMrh7: if ($uxhjq > 0) { $QJc0N->delay($uxhjq); } goto Ot3MT; tMtq_: $QJc0N->subject = $xcAHX; goto B1jKO; DwgJE: self::checkConfig(); goto TD84K; WsuSt: $QJc0N->email = $c6i2z; goto tMtq_; LTPsr: $QJc0N->emailUserName = $LnjH9; goto UVE9X; UVE9X: $QJc0N->option = $It5Ki; goto hMrh7; Ot3MT: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($QJc0N); goto mUBXO; mUBXO: } 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 TcsJ6; lSThd: $QJc0N->subject = $xcAHX; goto MEL07; Mi0JX: if ($uxhjq > 0) { $QJc0N->delay($uxhjq); } goto tbIrG; tbIrG: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($QJc0N); goto QvS3t; TcsJ6: self::checkConfig(); goto oHjlx; iEzHZ: $QJc0N->option = $It5Ki; goto XNFrX; XNFrX: $QJc0N->module = $WQ9HU; goto Mi0JX; MEL07: $QJc0N->template = $H09n_; goto r4X0W; oHjlx: $QJc0N = new static(); goto dXdfm; EHPuq: $QJc0N->emailUserName = $LnjH9; goto iEzHZ; r4X0W: $QJc0N->templateData = $JKXDQ; goto EHPuq; dXdfm: $QJc0N->email = $c6i2z; goto lSThd; QvS3t: } public function handle() { goto MPhlz; PyTKI: BizException::throwsIfResponseError($Gs3Xd); goto Nr6J5; I3bY7: $Gs3Xd = $QCsX1->send($this->email, $this->emailUserName, $this->subject, $yPdr6); goto PyTKI; XXILk: switch ($this->type) { case 'html': $yPdr6 = $this->html; break; default: goto dhX7R; dhX7R: $wFt7y = $this->template; goto cSwZH; M4zyJ: $yPdr6 = View::make($wFt7y, $this->templateData)->render(); goto Z4Paa; b8nF0: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto M4zyJ; cSwZH: 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 pyfFg; pyfFg: if (!view()->exists($wFt7y)) { throw new \Exception('mail view not found : ' . $wFt7y); } goto b8nF0; Z4Paa: break; goto k11Du; k11Du: } goto zOQMw; Sb8Sc: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto XXILk; Nr6J5: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto PDzMp; MPhlz: $sefXk = app()->config->get('EmailSenderProvider'); goto GT83F; zOQMw: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $yPdr6); goto I3bY7; GT83F: $QCsX1 = MailSenderProvider::get($sefXk); goto Sb8Sc; PDzMp: } }