<?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() { $kHDkQ = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $kHDkQ); } public static function createHtml($ynBrC, $WNH3r, $S_vgw, $m41TW = null, $f2U49 = array(), $W3L1K = 0) { goto R6yEW; Z1GKP: $bicx_ = new static(); goto INmTq; vfwES: $bicx_->option = $f2U49; goto Aoowq; Aoowq: if ($W3L1K > 0) { $bicx_->delay($W3L1K); } goto U4aVz; U4aVz: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($bicx_); goto o38Ez; RNdYo: $bicx_->email = $ynBrC; goto Kf3t7; ihuBg: $bicx_->html = $S_vgw; goto B362q; B362q: $bicx_->emailUserName = $m41TW; goto vfwES; R6yEW: self::checkConfig(); goto Z1GKP; Kf3t7: $bicx_->subject = $WNH3r; goto ihuBg; INmTq: $bicx_->type = 'html'; goto RNdYo; o38Ez: } public static function createModule($FgH5V, $np9vN, $ynBrC, $WNH3r, $DlEFb = array(), $m41TW = null, $f2U49 = array(), $W3L1K = 0) { self::create($ynBrC, $WNH3r, $np9vN, $DlEFb, $m41TW, $f2U49, $W3L1K, $FgH5V); } public static function create($ynBrC, $WNH3r, $np9vN, $DlEFb = array(), $m41TW = null, $f2U49 = array(), $W3L1K = 0, $FgH5V = null) { goto wEilD; MJG0h: if ($W3L1K > 0) { $bicx_->delay($W3L1K); } goto trGAp; SU2Fh: $bicx_->emailUserName = $m41TW; goto K_fYT; K_fYT: $bicx_->option = $f2U49; goto lMjLN; mY7Kj: $bicx_ = new static(); goto pjtfm; rM7UZ: $bicx_->templateData = $DlEFb; goto SU2Fh; gjiax: $bicx_->template = $np9vN; goto rM7UZ; Ydyhx: $bicx_->subject = $WNH3r; goto gjiax; pjtfm: $bicx_->email = $ynBrC; goto Ydyhx; trGAp: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($bicx_); goto uP0jD; lMjLN: $bicx_->module = $FgH5V; goto MJG0h; wEilD: self::checkConfig(); goto mY7Kj; uP0jD: } public function handle() { goto eOboq; G3AEL: BizException::throwsIfResponseError($ZrjxR); goto pT9HZ; KO37S: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $S_vgw); goto VdG1g; pT9HZ: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto jAppC; Moyt1: switch ($this->type) { case 'html': $S_vgw = $this->html; break; default: goto adlsH; adlsH: $faKDa = $this->template; goto EgeM4; MRcxv: $S_vgw = View::make($faKDa, $this->templateData)->render(); goto oYXeQ; p5Rw1: if (!view()->exists($faKDa)) { throw new \Exception('mail view not found : ' . $faKDa); } goto y2RIQ; oYXeQ: break; goto dB_3u; y2RIQ: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto MRcxv; EgeM4: if (!view()->exists($faKDa)) { $faKDa = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($faKDa)) { $faKDa = 'theme.default.mail.' . $this->template; if (!view()->exists($faKDa)) { if ($this->module) { $faKDa = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($faKDa)) { $faKDa = 'module::Vendor.View.mail.' . $this->template; } } } } goto p5Rw1; dB_3u: } goto KO37S; eOboq: $kHDkQ = app()->config->get('EmailSenderProvider'); goto T6vFr; T6vFr: $CGEHS = MailSenderProvider::get($kHDkQ); goto eN3YV; VdG1g: $ZrjxR = $CGEHS->send($this->email, $this->emailUserName, $this->subject, $S_vgw); goto G3AEL; eN3YV: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto Moyt1; jAppC: } }