mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
43 lines
933 B
PHP
43 lines
933 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Services\MailService;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class SendEmailJob implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
protected $params;
|
|
|
|
public $tries = 3;
|
|
public $timeout = 10;
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($params, $queue = 'send_email')
|
|
{
|
|
$this->onQueue($queue);
|
|
$this->params = $params;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
$mailLog = MailService::sendEmail($this->params);
|
|
if($mailLog['error']){
|
|
$this->release(); //发送失败将触发重试
|
|
}
|
|
}
|
|
}
|