合并分支 'master-lyh-edit' 到 'master'
Master lyh edit 查看合并请求 !586
正在显示
2 个修改的文件
包含
27 行增加
和
27 行删除
| @@ -42,27 +42,27 @@ class Demo extends Command | @@ -42,27 +42,27 @@ class Demo extends Command | ||
| 42 | { | 42 | { |
| 43 | $this->param['project_id'] = 181; | 43 | $this->param['project_id'] = 181; |
| 44 | $imageModel = new ImageModel(); | 44 | $imageModel = new ImageModel(); |
| 45 | -// //获取当前项目的所有图片 | ||
| 46 | -// $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']); | ||
| 47 | -// if(!empty($imageList)){ | ||
| 48 | -// $amazonS3Service = new AmazonS3Service(); | ||
| 49 | -// foreach ($imageList as $k => $v){ | ||
| 50 | -// $amazonS3Service->syncImageFiles(getImageUrl($v['path'])); | ||
| 51 | -// $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]); | ||
| 52 | -// } | ||
| 53 | -// } | ||
| 54 | - | ||
| 55 | - $fileModel = new FileModel(); | ||
| 56 | - $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']); | ||
| 57 | - if(!empty($fileList)){ | 45 | + //获取当前项目的所有图片 |
| 46 | + $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']); | ||
| 47 | + if(!empty($imageList)){ | ||
| 58 | $amazonS3Service = new AmazonS3Service(); | 48 | $amazonS3Service = new AmazonS3Service(); |
| 59 | - foreach ($fileList as $k => $v){ | ||
| 60 | - echo date('Y-m-d H:i:s') . '执行的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL; | ||
| 61 | - $amazonS3Service->syncImageFiles(getFileUrl($v['path'])); | ||
| 62 | - $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]); | ||
| 63 | - gc_collect_cycles(); | 49 | + foreach ($imageList as $k => $v){ |
| 50 | + $amazonS3Service->syncImageFiles(getImageUrl($v['path'])); | ||
| 51 | + $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]); | ||
| 64 | } | 52 | } |
| 65 | } | 53 | } |
| 54 | + | ||
| 55 | +// $fileModel = new FileModel(); | ||
| 56 | +// $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']); | ||
| 57 | +// if(!empty($fileList)){ | ||
| 58 | +// $amazonS3Service = new AmazonS3Service(); | ||
| 59 | +// foreach ($fileList as $k => $v){ | ||
| 60 | +// echo date('Y-m-d H:i:s') . '执行的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL; | ||
| 61 | +// $amazonS3Service->syncImageFiles(getFileUrl($v['path'])); | ||
| 62 | +// $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]); | ||
| 63 | +// gc_collect_cycles(); | ||
| 64 | +// } | ||
| 65 | +// } | ||
| 66 | return true; | 66 | return true; |
| 67 | } | 67 | } |
| 68 | 68 |
| @@ -64,6 +64,15 @@ class CopyProjectJob implements ShouldQueue | @@ -64,6 +64,15 @@ class CopyProjectJob implements ShouldQueue | ||
| 64 | $project_id = $projectModel->insertGetId($data); | 64 | $project_id = $projectModel->insertGetId($data); |
| 65 | $hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890'); | 65 | $hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890'); |
| 66 | $projectModel->edit(['from_order_id'=>$hashids->encode($project_id)],['id'=>$project_id]); | 66 | $projectModel->edit(['from_order_id'=>$hashids->encode($project_id)],['id'=>$project_id]); |
| 67 | + //复制设置的模版 | ||
| 68 | + $settingTemplateModel = new Setting(); | ||
| 69 | + $settingData = $settingTemplateModel::where('project_id', $this->param['project_id'])->first(); | ||
| 70 | + if(!empty($settingData)){ | ||
| 71 | + $settingData = $settingData->getAttributes(); | ||
| 72 | + unset($settingData['id']); | ||
| 73 | + $settingData['project_id'] = $project_id; | ||
| 74 | + $settingTemplateModel->insert($settingData); | ||
| 75 | + } | ||
| 67 | //复制部署表 | 76 | //复制部署表 |
| 68 | $buildModel = new DeployBuild(); | 77 | $buildModel = new DeployBuild(); |
| 69 | $buildData = $buildModel::where('project_id', $this->param['project_id'])->first(); | 78 | $buildData = $buildModel::where('project_id', $this->param['project_id'])->first(); |
| @@ -114,15 +123,6 @@ class CopyProjectJob implements ShouldQueue | @@ -114,15 +123,6 @@ class CopyProjectJob implements ShouldQueue | ||
| 114 | $userData['project_id'] = $project_id; | 123 | $userData['project_id'] = $project_id; |
| 115 | $userModel->insert($userData); | 124 | $userModel->insert($userData); |
| 116 | } | 125 | } |
| 117 | - //复制设置的模版 | ||
| 118 | - $settingTemplateModel = new Setting(); | ||
| 119 | - $settingData = $settingTemplateModel::where('project_id', $this->param['project_id'])->first(); | ||
| 120 | - if(!empty($settingData)){ | ||
| 121 | - $settingData = $settingData->getAttributes(); | ||
| 122 | - unset($settingData['id']); | ||
| 123 | - $settingData['project_id'] = $project_id; | ||
| 124 | - $settingTemplateModel->insert($settingData); | ||
| 125 | - } | ||
| 126 | DB::commit(); | 126 | DB::commit(); |
| 127 | }catch (\Exception $e){ | 127 | }catch (\Exception $e){ |
| 128 | DB::rollBack(); | 128 | DB::rollBack(); |
-
请 注册 或 登录 后发表评论