/**
* Execute the job.
*
* @return void
*/
public function handle()
{
// 判断 原始主题ID 是否为空,为空则为安装主题,否则为复制主题
if (empty($this->themeInstallationTask->themeInstallation->original_theme_id)) {
// 下载 ZIP
$downloadZipRes = $this->downloadZip();
// 解压缩 ZIP
self::$absolutePath = $downloadZipRes['absolutePath'];
$this->unzip($downloadZipRes['destination']);
// 执行安装命令
self::$destination = $downloadZipRes['destination'];
$this->execInstallationCommand($this->themeInstallationTask->themeInstallation->theme_id);
} else {
// 复制主题文件
$this->copyThemeAsset();
}
// 同步主题的素材至CDN
$this->syncThemeAssetCdn($this->themeInstallationTask->themeInstallation->theme_id);
$this->themeInstallationTask->themeInstallation->processing = ThemeInstallation::PROCESSING_FALSE;
$this->themeInstallationTask->themeInstallation->processing_failed = ThemeInstallation::PROCESSING_FAILED_FALSE;
$this->themeInstallationTask->themeInstallationVersionPreset->processing = ThemeInstallationVersionPreset::PROCESSING_FALSE;
$this->themeInstallationTask->themeInstallationVersionPreset->processing_failed = ThemeInstallationVersionPreset::PROCESSING_FAILED_FALSE;
$this->themeInstallationTask->processing = ThemeInstallationTask::PROCESSING_FALSE;
$this->themeInstallationTask->processing_failed = ThemeInstallationTask::PROCESSING_FAILED_FALSE;
$this->themeInstallationTask->push();
event(new ThemeCreated($this->themeInstallationTask->themeInstallation->theme));
}

/**
* 同步主题的素材至CDN
*
* @param string $themeId 主题 ID
* @return void
*/
private function syncThemeAssetCdn($themeId)
{
$this->themeInstallationTask->step = ThemeInstallationTask::STEP_SYNC_THEME_ASSET_CDN;
$this->themeInstallationTask->save();
// 程序开始的地方
app(ExecCommandHandler::class)->syncThemeAssetCdn($themeId);
sleep(60);
// 程序结束的地方,中途未抛出异常
}

PS E:\wwwroot\object> php artisan queue:work
[2022-08-04 13:57:07][tnFIT28iqbv67GpZ2xwzP6hRFEaJJ6vh] Processing: Modules\ThemeStoreDB\Jobs\ThemeInstallationJob
PS E:\wwwroot\object>


PS C:\Windows\system32> php-cgi.exe -b 127.0.0.1:9001-c C:/php-7.4.27/php.ini
PS C:\Windows\system32>
PHP / Laravel / Yii2 老项目维护与长期技术支持
如果你的 PHP / Laravel / Yii2 项目已经上线,但遇到原开发离职、Bug 长期无人修复、接口不稳定、性能下降、代码难以接手等问题,可以联系我做一次远程技术排查。
适合以下情况:
✅ 老旧 PHP 系统无人维护
✅ Laravel / Yii2 项目 Bug 修复
✅ 后台管理系统小功能迭代
✅ RESTful API 接口排查
✅ MySQL / Redis / Nginx 性能问题
✅ 长期远程兼职维护
可先从一次小问题开始:
✅ 线上报错排查
✅ 接口异常分析
✅ 慢查询与性能瓶颈定位
✅ 代码结构初步评估
✅ 部署环境与日志检查
如需咨询,请联系我,并注明:PHP 维护咨询。
联系方式:
Telegram:@shuijingwan
微信:13980074657
邮箱:shuijingwanwq@gmail.com

发表回复