作者 lyh

gx

@@ -532,6 +532,8 @@ class ProjectLogic extends BaseLogic @@ -532,6 +532,8 @@ class ProjectLogic extends BaseLogic
532 * @time :2023/11/8 14:23 532 * @time :2023/11/8 14:23
533 */ 533 */
534 public function copyProject(){ 534 public function copyProject(){
  535 + DB::beginTransaction();
  536 + try {
535 //复制初始项目 537 //复制初始项目
536 $data = $this->model::where('id', $this->param['project_id'])->first(); 538 $data = $this->model::where('id', $this->param['project_id'])->first();
537 $data = $data->getAttributes(); 539 $data = $data->getAttributes();
@@ -596,6 +598,12 @@ class ProjectLogic extends BaseLogic @@ -596,6 +598,12 @@ class ProjectLogic extends BaseLogic
596 $settingData['project_id'] = $project_id; 598 $settingData['project_id'] = $project_id;
597 $settingTemplateModel->insert($settingData); 599 $settingTemplateModel->insert($settingData);
598 } 600 }
  601 + DB::commit();
  602 + }catch (\Exception $e){
  603 + DB::rollBack();
  604 + $this->fail('error');
  605 + }
  606 +
599 $this->copyMysql($this->param['project_id'],$project_id); 607 $this->copyMysql($this->param['project_id'],$project_id);
600 return $this->success($data); 608 return $this->success($data);
601 } 609 }