<?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() { $pXrNS = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $pXrNS); } public static function createHtml($ber3G, $UFLoy, $FpbVq, $oVg5w = null, $LAk9h = array(), $FgaY_ = 0) { goto A19hy; o4FdH: $jm4we->html = $FpbVq; goto whNT0; whNT0: $jm4we->emailUserName = $oVg5w; goto ILTAB; F340k: $jm4we = new static(); goto QEewD; A19hy: self::checkConfig(); goto F340k; tIWlB: $jm4we->email = $ber3G; goto DGL2P; QEewD: $jm4we->type = 'html'; goto tIWlB; DGL2P: $jm4we->subject = $UFLoy; goto o4FdH; TjlFv: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($jm4we); goto wbogk; ebke1: if ($FgaY_ > 0) { $jm4we->delay($FgaY_); } goto TjlFv; ILTAB: $jm4we->option = $LAk9h; goto ebke1; wbogk: } public static function createModule($z_J2N, $eMuYk, $ber3G, $UFLoy, $EIJx6 = array(), $oVg5w = null, $LAk9h = array(), $FgaY_ = 0) { self::create($ber3G, $UFLoy, $eMuYk, $EIJx6, $oVg5w, $LAk9h, $FgaY_, $z_J2N); } public static function create($ber3G, $UFLoy, $eMuYk, $EIJx6 = array(), $oVg5w = null, $LAk9h = array(), $FgaY_ = 0, $z_J2N = null) { goto OJ2_p; jFljn: if ($FgaY_ > 0) { $jm4we->delay($FgaY_); } goto W_Eu7; f1LGM: $jm4we->email = $ber3G; goto KrXig; BADlz: $jm4we->option = $LAk9h; goto WqSDP; RFZ8d: $jm4we->template = $eMuYk; goto Bj4QP; KrXig: $jm4we->subject = $UFLoy; goto RFZ8d; Bj4QP: $jm4we->templateData = $EIJx6; goto jGD4i; W_Eu7: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($jm4we); goto VTBN3; W9Uir: $jm4we = new static(); goto f1LGM; OJ2_p: self::checkConfig(); goto W9Uir; jGD4i: $jm4we->emailUserName = $oVg5w; goto BADlz; WqSDP: $jm4we->module = $z_J2N; goto jFljn; VTBN3: } public function handle() { goto q2rdJ; eOa7R: switch ($this->type) { case 'html': $FpbVq = $this->html; break; default: goto ojosT; ojosT: $N8SrS = $this->template; goto mUdu2; Q6VyP: break; goto MPjIS; COL80: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto Wz6wJ; mUdu2: if (!view()->exists($N8SrS)) { $N8SrS = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($N8SrS)) { $N8SrS = 'theme.default.mail.' . $this->template; if (!view()->exists($N8SrS)) { if ($this->module) { $N8SrS = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($N8SrS)) { $N8SrS = 'module::Vendor.View.mail.' . $this->template; } } } } goto DM8k3; Wz6wJ: $FpbVq = View::make($N8SrS, $this->templateData)->render(); goto Q6VyP; DM8k3: if (!view()->exists($N8SrS)) { throw new \Exception('mail view not found : ' . $N8SrS); } goto COL80; MPjIS: } goto fptxu; q2rdJ: $pXrNS = app()->config->get('EmailSenderProvider'); goto jCpTO; jCpTO: $hKL6P = MailSenderProvider::get($pXrNS); goto ZT17Z; ZT17Z: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto eOa7R; GuNPZ: $gMg9x = $hKL6P->send($this->email, $this->emailUserName, $this->subject, $FpbVq); goto tMZgB; tMZgB: BizException::throwsIfResponseError($gMg9x); goto UEegU; fptxu: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $FpbVq); goto GuNPZ; UEegU: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto pKXF7; pKXF7: } }