作者 lyh

gx

@@ -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();
@@ -25,6 +25,7 @@ class NewsRequest extends FormRequest @@ -25,6 +25,7 @@ class NewsRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'name'=>'required|max:100', 27 'name'=>'required|max:100',
  28 + 'url'=>'required',
28 ]; 29 ];
29 } 30 }
30 31
@@ -33,6 +34,7 @@ class NewsRequest extends FormRequest @@ -33,6 +34,7 @@ class NewsRequest extends FormRequest
33 return [ 34 return [
34 'name.required'=>'请填写名称', 35 'name.required'=>'请填写名称',
35 'name.max'=>'名称最大100字', 36 'name.max'=>'名称最大100字',
  37 + 'url.required'=>'新闻链接不能为空'
36 ]; 38 ];
37 } 39 }
38 } 40 }