|
@@ -60,8 +60,8 @@ class NewsCategoryLogic extends BaseLogic |
|
@@ -60,8 +60,8 @@ class NewsCategoryLogic extends BaseLogic |
|
60
|
public function newsCategorySave(){
|
60
|
public function newsCategorySave(){
|
|
61
|
//验证名称是否存在
|
61
|
//验证名称是否存在
|
|
62
|
$this->verifyParamName($this->param['name']);
|
62
|
$this->verifyParamName($this->param['name']);
|
|
63
|
-// DB::beginTransaction();
|
|
|
|
64
|
-// try {
|
63
|
+ DB::beginTransaction();
|
|
|
|
64
|
+ try {
|
|
65
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
65
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
66
|
//验证是否可编辑
|
66
|
//验证是否可编辑
|
|
67
|
$this->verifyEditParam($this->param['id'],$this->param['pid']);
|
67
|
$this->verifyEditParam($this->param['id'],$this->param['pid']);
|
|
@@ -77,11 +77,11 @@ class NewsCategoryLogic extends BaseLogic |
|
@@ -77,11 +77,11 @@ class NewsCategoryLogic extends BaseLogic |
|
77
|
}
|
77
|
}
|
|
78
|
$route = RouteMap::setRoute(isset($this->param['alias']) ? $this->param['alias'] : $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
|
78
|
$route = RouteMap::setRoute(isset($this->param['alias']) ? $this->param['alias'] : $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
|
|
79
|
$this->model->edit(['alias'=>$route],['id'=>$id]);
|
79
|
$this->model->edit(['alias'=>$route],['id'=>$id]);
|
|
80
|
-// DB::commit();
|
|
|
|
81
|
-// }catch (\Exception $e){
|
|
|
|
82
|
-// DB::rollBack();
|
|
|
|
83
|
-// $this->fail('error');
|
|
|
|
84
|
-// }
|
80
|
+ DB::commit();
|
|
|
|
81
|
+ }catch (\Exception $e){
|
|
|
|
82
|
+ DB::rollBack();
|
|
|
|
83
|
+ $this->fail('error');
|
|
|
|
84
|
+ }
|
|
85
|
//更新通知记录表
|
85
|
//更新通知记录表
|
|
86
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]);
|
86
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]);
|
|
87
|
return $this->success();
|
87
|
return $this->success();
|