作者 lyh

gx

@@ -57,7 +57,7 @@ class BlogLogic extends BaseLogic @@ -57,7 +57,7 @@ class BlogLogic extends BaseLogic
57 */ 57 */
58 public function blogSave(){ 58 public function blogSave(){
59 //拼接参数 59 //拼接参数
60 -// DB::beginTransaction(); 60 + DB::beginTransaction();
61 try { 61 try {
62 $this->param = $this->paramProcessing($this->param); 62 $this->param = $this->paramProcessing($this->param);
63 if(isset($this->param['id']) && !empty($this->param['id'])){ 63 if(isset($this->param['id']) && !empty($this->param['id'])){
@@ -69,11 +69,11 @@ class BlogLogic extends BaseLogic @@ -69,11 +69,11 @@ class BlogLogic extends BaseLogic
69 } 69 }
70 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); 70 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $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('error');  
76 -// } 72 + DB::commit();
  73 + }catch (\Exception $e){
  74 + DB::rollBack();
  75 + $this->fail('error');
  76 + }
77 //通知更新 77 //通知更新
78 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]); 78 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);
79 return $this->success(); 79 return $this->success();
@@ -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();
@@ -177,12 +177,16 @@ class NewsLogic extends BaseLogic @@ -177,12 +177,16 @@ class NewsLogic extends BaseLogic
177 public function paramProcessing($param){ 177 public function paramProcessing($param){
178 if(isset($this->param['id'])){ 178 if(isset($this->param['id'])){
179 $param['operator_id'] = $this->user['id']; 179 $param['operator_id'] = $this->user['id'];
180 - $param['category_id'] = ','.trim($param['category_id'],',').','; 180 + if(isset($param['category_id']) && !empty($param['category_id'])){
  181 + $param['category_id'] = ','.trim($param['category_id'],',').',';
  182 + }
181 }else{ 183 }else{
182 $param['create_id'] = $this->user['id']; 184 $param['create_id'] = $this->user['id'];
183 $param['operator_id'] = $this->user['id']; 185 $param['operator_id'] = $this->user['id'];
184 $param['project_id'] = $this->user['project_id']; 186 $param['project_id'] = $this->user['project_id'];
185 - $param['category_id'] = ','.$param['category_id'].','; 187 + if(isset($param['category_id']) && !empty($param['category_id'])){
  188 + $param['category_id'] = ','.$param['category_id'].',';
  189 + }
186 } 190 }
187 return $this->success($param); 191 return $this->success($param);
188 } 192 }