|
...
|
...
|
@@ -117,6 +117,8 @@ class BlogLogic extends BaseLogic |
|
|
|
}
|
|
|
|
RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
//清除缓存
|
|
|
|
Common::del_user_cache($this->model->getTable(),$this->param['id']);
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
...
|
...
|
@@ -136,6 +138,8 @@ class BlogLogic extends BaseLogic |
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
//清除缓存
|
|
|
|
Common::del_user_cache($this->model->getTable(),$this->param['id']);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
/**
|
|
...
|
...
|
@@ -145,19 +149,23 @@ class BlogLogic extends BaseLogic |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function blog_info(){
|
|
|
|
//读取缓存
|
|
|
|
$info = Common::get_user_cache($this->model->getTable(),$this->param['id']);
|
|
|
|
if(!empty($info)){
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
$info = $this->model->read($this->param);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
//获取分类名称
|
|
|
|
$cate = explode(',',trim($info['category_id'],','));
|
|
|
|
$blogCategoryModel = new BlogCategoryModel();
|
|
|
|
$category_list = $blogCategoryModel->list(['id'=>['in',$cate]],'id',['name']);
|
|
|
|
$str = '';
|
|
|
|
foreach ($category_list as $v){
|
|
|
|
$str .= $v['name'].',';
|
|
|
|
}
|
|
|
|
$info['category_name'] = trim($str,',');
|
|
|
|
$blogCategoryLogic = new BlogCategoryLogic();
|
|
|
|
$info = $blogCategoryLogic->get_category_name($info);
|
|
|
|
//获取标签名称
|
|
|
|
$blogLabelLogic = new BlogLabelLogic();
|
|
|
|
$info = $blogLabelLogic->get_label_name($info);
|
|
|
|
//写入缓存
|
|
|
|
Common::set_user_cache($info,$this->model->getTable(),$this->param['id']);
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|