作者 lyh

gx

@@ -57,9 +57,9 @@ class NewsCategoryLogic extends BaseLogic @@ -57,9 +57,9 @@ class NewsCategoryLogic extends BaseLogic
57 */ 57 */
58 public function newsCategorySave(){ 58 public function newsCategorySave(){
59 //验证名称是否存在 59 //验证名称是否存在
60 - $this->verifyParamName($this->param['name']);  
61 - DB::beginTransaction();  
62 - try { 60 +// $this->verifyParamName($this->param['name']);
  61 +// DB::beginTransaction();
  62 +// try {
63 if(isset($this->param['id']) && !empty($this->param['id'])){ 63 if(isset($this->param['id']) && !empty($this->param['id'])){
64 //验证是否可编辑 64 //验证是否可编辑
65 $this->verifyEditParam($this->param['id'],$this->param['pid']); 65 $this->verifyEditParam($this->param['id'],$this->param['pid']);
@@ -74,11 +74,11 @@ class NewsCategoryLogic extends BaseLogic @@ -74,11 +74,11 @@ class NewsCategoryLogic extends BaseLogic
74 } 74 }
75 $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); 75 $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
76 $this->model->edit(['alias'=>$route],['id'=>$id]); 76 $this->model->edit(['alias'=>$route],['id'=>$id]);
77 - DB::commit();  
78 - }catch (\Exception $e){  
79 - DB::rollBack();  
80 - $this->fail('error');  
81 - } 77 +// DB::commit();
  78 +// }catch (\Exception $e){
  79 +// DB::rollBack();
  80 +// $this->fail('error');
  81 +// }
82 //更新通知记录表 82 //更新通知记录表
83 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]); 83 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]);
84 return $this->success(); 84 return $this->success();
@@ -205,18 +205,6 @@ class NewsCategoryLogic extends BaseLogic @@ -205,18 +205,6 @@ class NewsCategoryLogic extends BaseLogic
205 return $this->success(); 205 return $this->success();
206 } 206 }
207 207
208 - /**  
209 - * @name :(参数处理)paramProcessing  
210 - * @author :lyh  
211 - * @method :post  
212 - * @time :2023/6/13 11:30  
213 - */  
214 - public function addParamProcessing($param){  
215 - $param['project_id'] = $this->user['project_id'];  
216 - $param['operator_id'] = $this->user['id'];  
217 - $param['create_id'] = $this->user['id'];  
218 - return $this->success($param);  
219 - }  
220 208
221 /** 209 /**
222 * @name :(添加分类时处理子集分类)addProcessingSon 210 * @name :(添加分类时处理子集分类)addProcessingSon
@@ -56,8 +56,8 @@ class NewsLogic extends BaseLogic @@ -56,8 +56,8 @@ class NewsLogic extends BaseLogic
56 */ 56 */
57 public function newsSave(){ 57 public function newsSave(){
58 //拼接参数 58 //拼接参数
59 -// DB::beginTransaction();  
60 -// try { 59 + DB::beginTransaction();
  60 + try {
61 $this->param = $this->paramProcessing($this->param); 61 $this->param = $this->paramProcessing($this->param);
62 if(isset($this->param['id']) && !empty($this->param['id'])){ 62 if(isset($this->param['id']) && !empty($this->param['id'])){
63 //是否更新路由 63 //是否更新路由
@@ -69,11 +69,11 @@ class NewsLogic extends BaseLogic @@ -69,11 +69,11 @@ class NewsLogic extends BaseLogic
69 //更新路由 69 //更新路由
70 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); 70 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
71 $this->edit(['url'=>$route],['id'=>$id]); 71 $this->edit(['url'=>$route],['id'=>$id]);
72 -// DB::commit();  
73 -// }catch (\Exception $e){  
74 -// DB::rollBack();  
75 -// $this->fail('添加失败');  
76 -// } 72 + DB::commit();
  73 + }catch (\Exception $e){
  74 + DB::rollBack();
  75 + $this->fail('添加失败');
  76 + }
77 //通知更新 77 //通知更新
78 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS, 'route'=>$route]); 78 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS, 'route'=>$route]);
79 return $this->success(); 79 return $this->success();