作者 lyh

gx

@@ -66,12 +66,15 @@ class CustomTemplateLogic extends BaseLogic @@ -66,12 +66,15 @@ class CustomTemplateLogic extends BaseLogic
66 } 66 }
67 $id = $this->param['id']; 67 $id = $this->param['id'];
68 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 68 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  69 + if($rs === false){
  70 + $this->fail('error');
  71 + }
69 }else{ 72 }else{
70 $this->param['project_id'] = $this->user['project_id']; 73 $this->param['project_id'] = $this->user['project_id'];
71 $id = $this->model->addReturnId($this->param); 74 $id = $this->model->addReturnId($this->param);
72 - }  
73 - if($rs === false){  
74 - $this->fail('error'); 75 + if($id === false){
  76 + $this->fail('error');
  77 + }
75 } 78 }
76 //路由映射 79 //路由映射
77 if(isset($this->param['url']) && !empty($this->param['url'])){ 80 if(isset($this->param['url']) && !empty($this->param['url'])){
@@ -66,8 +66,8 @@ class CategoryLogic extends BaseLogic @@ -66,8 +66,8 @@ class CategoryLogic extends BaseLogic
66 * @time :2023/8/21 17:14 66 * @time :2023/8/21 17:14
67 */ 67 */
68 public function categorySave(){ 68 public function categorySave(){
69 -// DB::beginTransaction();  
70 -// try { 69 + DB::beginTransaction();
  70 + try {
71 if(isset($this->param['id']) && !empty($this->param['id'])){ 71 if(isset($this->param['id']) && !empty($this->param['id'])){
72 $this->handleEditParam($this->param); 72 $this->handleEditParam($this->param);
73 $id = $this->param['id']; 73 $id = $this->param['id'];
@@ -78,11 +78,11 @@ class CategoryLogic extends BaseLogic @@ -78,11 +78,11 @@ class CategoryLogic extends BaseLogic
78 } 78 }
79 //路由映射 79 //路由映射
80 $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); 80 $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
81 -// DB::commit();  
82 -// } catch (\Exception $e){  
83 -// DB::rollBack();  
84 -// $this->fail('保存失败');  
85 -// } 81 + DB::commit();
  82 + } catch (\Exception $e){
  83 + DB::rollBack();
  84 + $this->fail('保存失败');
  85 + }
86 //通知更新 86 //通知更新
87 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route]); 87 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route]);
88 return $this->success(); 88 return $this->success();