|
...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
|
namespace App\Http\Logic\Bside\Blog;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Helper\Common;
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Http\Logic\Bside\User\UserLogic;
|
|
|
|
use App\Models\Blog\BlogCategory as BlogCategoryModel;
|
|
...
|
...
|
@@ -101,10 +102,7 @@ class BlogCategoryLogic extends BaseLogic |
|
|
|
$this->fail('当前分类名称已存在');
|
|
|
|
}
|
|
|
|
$this->param['operator_id'] = $this->user['id'];
|
|
|
|
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
$this->edit($this->param,$this->param['id']);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -115,9 +113,15 @@ class BlogCategoryLogic extends BaseLogic |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function info_blog_category(){
|
|
|
|
$info = $this->model->read($this->param);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('error');
|
|
|
|
//读取缓存
|
|
|
|
$info = Common::get_user_cache($this->model->getTable(),$this->param['id']);
|
|
|
|
if(empty($info)){
|
|
|
|
$info = $this->model->read($this->param);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
//写入缓存
|
|
|
|
Common::set_user_cache($info,$this->model->getTable(),$this->param['id']);
|
|
|
|
}
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
...
|
...
|
@@ -143,7 +147,8 @@ class BlogCategoryLogic extends BaseLogic |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function del_blog_category(){
|
|
|
|
foreach ($this->param['id'] as $v){
|
|
|
|
$ids = $this->param['id'];
|
|
|
|
foreach ($ids as $v){
|
|
|
|
//查询是否有子分类
|
|
|
|
$rs = $this->model->read(['pid'=>$v],['id']);
|
|
|
|
if($rs !== false){
|
|
...
|
...
|
@@ -157,10 +162,7 @@ class BlogCategoryLogic extends BaseLogic |
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->param['id'] = ['in',$this->param['id']];
|
|
|
|
$rs = $this->model->del($this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->response('error');
|
|
|
|
}
|
|
|
|
$this->del($this->param,$ids);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|