作者 lyh

gx

@@ -95,7 +95,7 @@ class BlogController extends BaseController @@ -95,7 +95,7 @@ class BlogController extends BaseController
95 $category_id = $assCateModel->formatQuery(['type_id'=>$id,'type'=>$assCateModel::BLOG_CATE])->pluck('category_id')->toArray(); 95 $category_id = $assCateModel->formatQuery(['type_id'=>$id,'type'=>$assCateModel::BLOG_CATE])->pluck('category_id')->toArray();
96 if(!empty($category_id)){ 96 if(!empty($category_id)){
97 $categoryModel = new BlogCategory(); 97 $categoryModel = new BlogCategory();
98 - $category_name_arr = $categoryModel->formatQuery(['category_id'=>['in',$category_id]])->pluck('name')->toArray(); 98 + $category_name_arr = $categoryModel->formatQuery(['id'=>['in',$category_id]])->pluck('name')->toArray();
99 $str = explode(',',$category_name_arr); 99 $str = explode(',',$category_name_arr);
100 } 100 }
101 } 101 }
@@ -54,8 +54,8 @@ class BlogLogic extends BaseLogic @@ -54,8 +54,8 @@ class BlogLogic extends BaseLogic
54 */ 54 */
55 public function blogSave(){ 55 public function blogSave(){
56 //拼接参数 56 //拼接参数
57 -// DB::beginTransaction();  
58 -// try { 57 + DB::beginTransaction();
  58 + try {
59 $category = $this->param['category_id']; 59 $category = $this->param['category_id'];
60 $this->param = $this->paramProcessing($this->param); 60 $this->param = $this->paramProcessing($this->param);
61 if(isset($this->param['id']) && !empty($this->param['id'])){ 61 if(isset($this->param['id']) && !empty($this->param['id'])){
@@ -70,11 +70,11 @@ class BlogLogic extends BaseLogic @@ -70,11 +70,11 @@ class BlogLogic extends BaseLogic
70 if(!empty($category)){ 70 if(!empty($category)){
71 $this->saveAssociationCate($id,$category); 71 $this->saveAssociationCate($id,$category);
72 } 72 }
73 -// DB::commit();  
74 -// }catch (\Exception $e){  
75 -// DB::rollBack();  
76 -// $this->fail('error');  
77 -// } 73 + DB::commit();
  74 + }catch (\Exception $e){
  75 + DB::rollBack();
  76 + $this->fail('error');
  77 + }
78 //通知更新 78 //通知更新
79 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]); 79 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);
80 return $this->success(); 80 return $this->success();