<?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() { $oMd7I = app()->config->get('EmailSenderProvider'); BizException::throwsIfEmpty('邮箱发送未设置', $oMd7I); } public static function createHtml($dRXuh, $vGHhs, $AZvp2, $b2BhF = null, $iNhXN = array(), $KibPG = 0) { goto vFu__; LaKxB: $pJeg8->subject = $vGHhs; goto aEriv; vFu__: self::checkConfig(); goto WataG; Q4NNR: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($pJeg8); goto y1gFC; zyJTx: $pJeg8->type = 'html'; goto YPJlm; YPJlm: $pJeg8->email = $dRXuh; goto LaKxB; Xqpt_: if ($KibPG > 0) { $pJeg8->delay($KibPG); } goto Q4NNR; WataG: $pJeg8 = new static(); goto zyJTx; Y2x1a: $pJeg8->emailUserName = $b2BhF; goto ADoeT; aEriv: $pJeg8->html = $AZvp2; goto Y2x1a; ADoeT: $pJeg8->option = $iNhXN; goto Xqpt_; y1gFC: } public static function createModule($k8GtY, $Aj5L2, $dRXuh, $vGHhs, $QmY2j = array(), $b2BhF = null, $iNhXN = array(), $KibPG = 0) { self::create($dRXuh, $vGHhs, $Aj5L2, $QmY2j, $b2BhF, $iNhXN, $KibPG, $k8GtY); } public static function create($dRXuh, $vGHhs, $Aj5L2, $QmY2j = array(), $b2BhF = null, $iNhXN = array(), $KibPG = 0, $k8GtY = null) { goto NGX5K; zoho9: $pJeg8->subject = $vGHhs; goto zUMya; zUMya: $pJeg8->template = $Aj5L2; goto pvPES; i3YHK: $pJeg8->option = $iNhXN; goto piyMS; S16qb: $pJeg8 = new static(); goto SZ0cf; icOc7: app('Illuminate\\Contracts\\Bus\\Dispatcher')->dispatch($pJeg8); goto U2I6K; NGX5K: self::checkConfig(); goto S16qb; uWUJr: if ($KibPG > 0) { $pJeg8->delay($KibPG); } goto icOc7; pvPES: $pJeg8->templateData = $QmY2j; goto fFcDW; fFcDW: $pJeg8->emailUserName = $b2BhF; goto i3YHK; SZ0cf: $pJeg8->email = $dRXuh; goto zoho9; piyMS: $pJeg8->module = $k8GtY; goto uWUJr; U2I6K: } public function handle() { goto ZdUqr; zDle3: $ZO8gl = MailSenderProvider::get($oMd7I); goto X8iPV; Wql1L: BizException::throwsIfEmpty('MailSendJob.HtmlEmpty', $AZvp2); goto YMoiA; bq8qK: Logger::info('Email', 'End', $this->email . ' - ' . $this->subject); goto vQVVW; xIG9s: switch ($this->type) { case 'html': $AZvp2 = $this->html; break; default: goto lVvUY; DEEEs: if (null === $this->emailUserName) { $this->emailUserName = $this->email; } goto Zkr4z; SzWkx: break; goto Wxljj; Zkr4z: $AZvp2 = View::make($qVdRh, $this->templateData)->render(); goto SzWkx; lVvUY: $qVdRh = $this->template; goto zkl8Q; LNXbz: if (!view()->exists($qVdRh)) { throw new \Exception('mail view not found : ' . $qVdRh); } goto DEEEs; zkl8Q: if (!view()->exists($qVdRh)) { $qVdRh = 'theme.' . modstart_config()->getWithEnv('siteTemplate', 'default') . '.mail.' . $this->template; if (!view()->exists($qVdRh)) { $qVdRh = 'theme.default.mail.' . $this->template; if (!view()->exists($qVdRh)) { if ($this->module) { $qVdRh = 'module::' . $this->module . '.View.mail.' . $this->template; } if (!view()->exists($qVdRh)) { $qVdRh = 'module::Vendor.View.mail.' . $this->template; } } } } goto LNXbz; Wxljj: } goto Wql1L; YMoiA: $Tbn6c = $ZO8gl->send($this->email, $this->emailUserName, $this->subject, $AZvp2); goto aqA_k; ZdUqr: $oMd7I = app()->config->get('EmailSenderProvider'); goto zDle3; X8iPV: Logger::info('Email', 'Start', $this->email . ' - ' . $this->subject . ' - ' . $this->template); goto xIG9s; aqA_k: BizException::throwsIfResponseError($Tbn6c); goto bq8qK; vQVVW: } }