作者 lyh

gx

... ... @@ -95,7 +95,7 @@ class BlogController extends BaseController
$category_id = $assCateModel->formatQuery(['type_id'=>$id,'type'=>$assCateModel::BLOG_CATE])->pluck('category_id')->toArray();
if(!empty($category_id)){
$categoryModel = new BlogCategory();
$category_name_arr = $categoryModel->formatQuery(['category_id'=>['in',$category_id]])->pluck('name')->toArray();
$category_name_arr = $categoryModel->formatQuery(['id'=>['in',$category_id]])->pluck('name')->toArray();
$str = explode(',',$category_name_arr);
}
}
... ...
... ... @@ -54,8 +54,8 @@ class BlogLogic extends BaseLogic
*/
public function blogSave(){
//拼接参数
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$category = $this->param['category_id'];
$this->param = $this->paramProcessing($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
... ... @@ -70,11 +70,11 @@ class BlogLogic extends BaseLogic
if(!empty($category)){
$this->saveAssociationCate($id,$category);
}
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('error');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);
return $this->success();
... ...