作者 lyh

gx

... ... @@ -6,6 +6,7 @@ use App\Enums\Common\Code;
use App\Events\CopyImageFile;
use App\Events\CopyProject;
use App\Exceptions\AsideGlobalException;
use App\Jobs\CopyImageFileJob;
use App\Models\Com\NoticeLog;
use App\Models\Com\UpdateLog;
use App\Models\Devops\ServerConfig;
... ... @@ -165,7 +166,7 @@ class ProjectLogic extends BaseLogic
public function syncImageFile($location,$project_id){
if($location == 1){
CopyImageFile::dispatch(['project_id'=>$project_id]);
CopyImageFileJob::dispatch(['project_id'=>$project_id]);
}
return $this->success();
}
... ...
... ... @@ -23,9 +23,9 @@ class CopyImageFileJob implements ShouldQueue
* @param CopyImageFile $event
* @return void
*/
public function __construct(CopyImageFile $event)
public function __construct($data)
{
$this->param = $event->data;
$this->param = $data;
}
/**
... ...
<?php
namespace App\Listeners;
use App\Events\CopyImageFile;
use App\Events\UpdateHtml;
use App\Jobs\CopyImageFileJob;
use App\Jobs\updateHtmlJob;
use App\Models\File\File as FileModel;
use App\Models\File\Image as ImageModel;
use App\Services\AmazonS3Service;
use Illuminate\Contracts\Queue\ShouldQueue;
class CopyImageFileListener implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
public function __construct()
{
//
}
public function handle(CopyImageFile $event)
{
$this->param = $event->data;
// 将任务推送到队列,异步执行
dispatch(new CopyImageFileJob($event));
}
}