作者 lyh

gx

@@ -61,12 +61,12 @@ class NewsLogic extends BaseLogic @@ -61,12 +61,12 @@ class NewsLogic extends BaseLogic
61 public function newsSave() 61 public function newsSave()
62 { 62 {
63 //拼接参数 63 //拼接参数
64 -// DB::beginTransaction();  
65 -// try { 64 + DB::beginTransaction();
  65 + try {
66 $this->param = $this->paramProcessing($this->param); 66 $this->param = $this->paramProcessing($this->param);
67 if (isset($this->param['id']) && !empty($this->param['id'])) { 67 if (isset($this->param['id']) && !empty($this->param['id'])) {
68 //是否更新路由 68 //是否更新路由
69 -// $id = $this->editNewsRoute($this->param['id'], $this->param['url']); 69 + $id = $this->editNewsRoute($this->param['id'], $this->param['url']);
70 $this->edit($this->param, ['id' => $this->param['id']]); 70 $this->edit($this->param, ['id' => $this->param['id']]);
71 } else { 71 } else {
72 $id = $this->model->addReturnId($this->param); 72 $id = $this->model->addReturnId($this->param);
@@ -74,11 +74,11 @@ class NewsLogic extends BaseLogic @@ -74,11 +74,11 @@ class NewsLogic extends BaseLogic
74 //更新路由 74 //更新路由
75 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); 75 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
76 $this->edit(['url' => $route], ['id' => $id]); 76 $this->edit(['url' => $route], ['id' => $id]);
77 -// DB::commit();  
78 -// } catch (\Exception $e) {  
79 -// DB::rollBack();  
80 -// $this->fail('系统错误,请联系管理员');  
81 -// } 77 + DB::commit();
  78 + } catch (\Exception $e) {
  79 + DB::rollBack();
  80 + $this->fail('系统错误,请联系管理员');
  81 + }
82 //通知更新 82 //通知更新
83 $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]); 83 $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]);
84 return $this->success(); 84 return $this->success();