|
...
|
...
|
@@ -52,7 +52,7 @@ class BlogCategoryLogic extends BaseLogic |
|
|
|
//验证参数是否可编辑
|
|
|
|
$this->verifyParamEdit($this->param['id'],$this->param['pid']);
|
|
|
|
//查看路由是否更新
|
|
|
|
$this->editCategoryRoute($this->param['id'],$this->param['alias']);
|
|
|
|
$id = $this->editCategoryRoute($this->param['id'],$this->param['alias']);
|
|
|
|
$this->param['operator_id'] = $this->user['id'];
|
|
|
|
$this->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -94,51 +94,6 @@ class BlogCategoryLogic extends BaseLogic |
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :添加时验证上级分类是否有商品,有则替换带当前分类下
|
|
|
|
* @return void
|
|
|
|
* @author :liyuhang
|
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function add_blog_category(){
|
|
|
|
//验证名称是否存在
|
|
|
|
$this->verifyParamName($this->param['name']);
|
|
|
|
//拼接参数
|
|
|
|
$this->param = $this->addParamProcessing($this->param);
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
$cate_id = $this->model->insertGetId($this->param);
|
|
|
|
//处理子集
|
|
|
|
$this->addProcessingSon($cate_id);
|
|
|
|
$route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $cate_id, $this->user['project_id']);
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
//通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :编辑分类
|
|
|
|
* @return void
|
|
|
|
* @author :liyuhang
|
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function edit_blog_category(){
|
|
|
|
//验证名称是否存在
|
|
|
|
$this->verifyParamName($this->param['name'],$this->param['id']);
|
|
|
|
//验证参数是否可编辑
|
|
|
|
$this->verifyParamEdit($this->param['id'],$this->param['pid']);
|
|
|
|
$this->param['operator_id'] = $this->user['id'];
|
|
|
|
$this->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
$route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']);
|
|
|
|
//通知更新
|
|
|
|
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :查看参数是否可编辑
|
...
|
...
|
|