作者 lyh

gx复制项目

<?php
/**
* @remark :
* @name :CopyProject.php
* @author :lyh
* @method :post
* @time :2025/1/15 14:40
*/
namespace App\Jobs;
namespace App\Console\Commands\Project;
use App\Events\CopyProject;
use App\Events\UpdateHtml;
use App\Jobs\updateHtmlJob;
use App\Models\Project\After;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
... ... @@ -14,40 +18,27 @@ use App\Models\Template\Setting;
use App\Models\User\User as UserModel;
use App\Services\ProjectServer;
use Hashids\Hashids;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
class CopyProjectJob implements ShouldQueue
class CopyProject extends Command
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $tries = 3; // 可配置任务重试次数
protected $param;
/**
* Create a new job instance.
* The name and signature of the console command.
*
* @param CopyImageFile $event
* @return void
* @var string
*/
public function __construct($data)
{
$this->param = $data;
}
protected $signature = 'copy_project';
/**
* Handle the event.
* The console command description.
*
* @param UpdateHtml $event
* @return void
* @var string
*/
protected $description = 'copy--复制项目';
public function handle()
{
$projectModel = new Project();
... ...
... ... @@ -754,7 +754,7 @@ class ProjectLogic extends BaseLogic
* @time :2023/11/8 14:23
*/
public function copyProject(){
CopyProjectJob::dispatch(['project_id'=>$this->param['project_id']]);
NoticeLog::createLog(NoticeLog::TYPE_COPY_PROJECT, ['project_id' => $this->param['project_id']]);
return $this->success('项目复制中,请稍后前往初始化项目查看;');
}
... ...
... ... @@ -13,6 +13,7 @@ class NoticeLog extends Base
const TYPE_PROJECT = 'project';
const TYPE_RANK_DATA = 'rank_data';
const TYPE_INIT_PROJECT = 'init_project';
const TYPE_COPY_PROJECT = 'copy_project';
const TYPE_INIT_KEYWORD = 'init_keyword';
const DELETE_PRODUCT_CATEGORY = 'delete_product_category';
const DELETE_BLOG_CATEGORY = 'delete_blog_category';
... ...