作者 lyh

gx

@@ -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();