| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 | 
							- <?php
 
- namespace App\Services\Common;
 
- use App\Jobs\EmailJob;
 
- use Illuminate\Support\Facades\Cache;
 
- /**
 
-  * 邮件服务.
 
-  * Class EMailService
 
-  * @package App\Services\Common
 
-  */
 
- class EmailService
 
- {
 
-     /**
 
-      *邮箱测试
 
-      */
 
-     const TEMPLATE_TEST="mail_test";
 
-     /**
 
-      *邮箱验证
 
-      */
 
-     const TEMPLATE_VALIDATION="mail_vaildation";
 
-     /**
 
-      *邮箱重置密码
 
-      */
 
-     const TEMPLATE_PASSWORD_RESET="mail_password_reset";
 
-     /**
 
-      * 发送简历到邮箱
 
-      */
 
-     const  TEMPLATE_SEND_RESUME = 'mail_send_resume';
 
-     /**
 
-      * 发送自定义内容邮件
 
-      */
 
-     const  TEMPLATE_SEND_CONTENT = 'mail_send_content';
 
-     /**
 
-      * 招聘会预订成功
 
-      */
 
-     const  TEMPLATE_JOBFAIR_APPLY_OK = 'mail_jobfair_apply_ok';
 
-     /**
 
-      * 招聘会预定失败
 
-      */
 
-     const  TEMPLATE_JOBFAIR_APPLY_ERROR = 'mail_jobfair_apply_error';
 
-     /**
 
-      * 邀请面试
 
-      */
 
-     const  TEMPLATE_INVITE_INTERVIEWS = 'mail_invite';
 
-     /**
 
-      * 职位审核未通过
 
-      */
 
-     const  TEMPLATE_MAIL_JOBSNOTALLOW = 'mail_jobsnotallow';
 
-     /**
 
-      * 职位审核通过
 
-      */
 
-     const  TEMPLATE_MAIL_JOBSALLOW = 'mail_jobsallow';
 
-     /**
 
-      * @var array
 
-      */
 
-     protected $callback;
 
-     /**
 
-      * @var string
 
-      */
 
-     protected $authTag;
 
-     protected $check_route;
 
-     /**
 
-      * SmsService constructor.
 
-      */
 
-     public function __construct()
 
-     {
 
-         $this->callback = [];
 
-         $this->authTag='none';
 
-         $this->check_route="email.check";
 
-     }
 
-     /**
 
-      * 发送邮件
 
-      * @param \Eloquent|string $email
 
-      * @param string $templateId
 
-      * @param array $titleParams
 
-      * @param array $contentParams
 
-      */
 
-     public function sendMail($email, string $templateId, array $titleParams = [], array $contentParams = [])
 
-     {
 
-         $emailJob=new EmailJob($email, $templateId, $titleParams, $contentParams);
 
-         $emailJob->setCallback($this->callback);
 
-         dispatch($emailJob);
 
-     }
 
-     /**
 
-      * 发送确认邮件
 
-      * @param \Eloquent|string $email
 
-      * @param string $templateId
 
-      */
 
-     public function sendAuthMail($email, string $templateId)
 
-     {
 
-         $emailJob=new EmailJob($email, $templateId, [], [], true);
 
-         $emailJob->setCallback($this->callback);
 
-         $emailJob->setTag($this->authTag);
 
-         $emailJob->setCheckRoute($this->check_route);
 
-         dispatch($emailJob);
 
-     }
 
-     /**
 
-      * 根据邮箱code返回缓存信息,如果存在则包含email,邮件模板alias两个字段
 
-      * @param string $code
 
-      * @return null|array
 
-      */
 
-     public function checkAuthEmail(string $code)
 
-     {
 
-         $result=Cache::pull($code, null);
 
-         return $result;
 
-     }
 
-     /**
 
-      * 批量发送短信
 
-      * @param array $mobiles
 
-      * @param string $templateId
 
-      * @param array $params
 
-      */
 
-     public function sendBatchSms(array $mobiles, string $templateId, array $params = [])
 
-     {
 
-         //
 
-     }
 
-     /**
 
-      * @param string $obj
 
-      * @param string $method
 
-      * @param array $args
 
-      * @return EmailService
 
-      */
 
-     public function setCallback(string $obj, string $method, array $args)
 
-     {
 
-         $this->callback[]=[$obj, $method];
 
-         $this->callback[]=$args;
 
-         return $this;
 
-     }
 
-     public function setAuthTag(string $tag)
 
-     {
 
-         $this->authTag=$tag;
 
-         return $this;
 
-     }
 
-     /**
 
-      * @param string $check_route
 
-      * @return EmailService
 
-      */
 
-     public function setCheckRoute(string $check_route)
 
-     {
 
-         $this->check_route = $check_route;
 
-         return $this;
 
-     }
 
- }
 
 
  |