作者 lyh

gx

@@ -91,7 +91,7 @@ class BlogCategoryLogic extends BaseLogic @@ -91,7 +91,7 @@ class BlogCategoryLogic extends BaseLogic
91 */ 91 */
92 public function getLastId($id){ 92 public function getLastId($id){
93 $info = $this->model->read(['pid'=>$id],['id']); 93 $info = $this->model->read(['pid'=>$id],['id']);
94 - if($info == false){ 94 + if($info !== false){
95 return $this->getLastId($id); 95 return $this->getLastId($id);
96 }else{ 96 }else{
97 return $id; 97 return $id;
@@ -101,7 +101,7 @@ class NewsCategoryLogic extends BaseLogic @@ -101,7 +101,7 @@ class NewsCategoryLogic extends BaseLogic
101 */ 101 */
102 public function getLastId($id){ 102 public function getLastId($id){
103 $info = $this->model->read(['pid'=>$id],['id']); 103 $info = $this->model->read(['pid'=>$id],['id']);
104 - if($info == false){ 104 + if($info !== false){
105 return $this->getLastId($id); 105 return $this->getLastId($id);
106 }else{ 106 }else{
107 return $id; 107 return $id;
@@ -61,8 +61,8 @@ class NewsLogic extends BaseLogic @@ -61,8 +61,8 @@ 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 //是否更新路由
@@ -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();
@@ -349,12 +349,10 @@ class ProductLogic extends BaseLogic @@ -349,12 +349,10 @@ class ProductLogic extends BaseLogic
349 'status'=>$this->param['status'] 349 'status'=>$this->param['status']
350 ]; 350 ];
351 $this->model->edit($param,['id'=>['in',$this->param['id']]]); 351 $this->model->edit($param,['id'=>['in',$this->param['id']]]);
352 -  
353 //分类关联 352 //分类关联
354 foreach ($this->param['id'] as $id){ 353 foreach ($this->param['id'] as $id){
355 CategoryRelated::saveRelated($id, $this->param['category_id']); 354 CategoryRelated::saveRelated($id, $this->param['category_id']);
356 } 355 }
357 -  
358 DB::connection('custom_mysql')->commit(); 356 DB::connection('custom_mysql')->commit();
359 //对应添加关联表 357 //对应添加关联表
360 }catch (\Exception $e){ 358 }catch (\Exception $e){