|
...
|
...
|
@@ -117,6 +117,8 @@ class CustomModuleCategoryLogic extends BaseLogic |
|
|
|
$this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],$route);
|
|
|
|
$this->curlDelRoute(['new_route'=>$route]);
|
|
|
|
$this->edit(['url' => $route], ['id' => $id]);
|
|
|
|
//处理上级分类商品
|
|
|
|
$this->handleAddSon($id);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
}
|
|
...
|
...
|
@@ -142,6 +144,32 @@ class CustomModuleCategoryLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :编辑分类,处理博客数据
|
|
|
|
* @name :editCategory
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/10/20 9:32
|
|
|
|
*/
|
|
|
|
public function editHandleCategory($id,$pid){
|
|
|
|
$info = $this->model->read(['id'=>$id],['id','pid']);
|
|
|
|
if($info['pid'] != $pid){
|
|
|
|
//修改勒上级,先查看上级是否拥有博客
|
|
|
|
$contentModel = new CustomModuleContent();
|
|
|
|
$newsCount = $contentModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count();
|
|
|
|
//随机获取最后一级id
|
|
|
|
$replacement = $this->getLastId($id);
|
|
|
|
if($newsCount > 0){
|
|
|
|
//存在博客时,移动所有博客到当前分类最后一级
|
|
|
|
$newsCount->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%')
|
|
|
|
->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]);
|
|
|
|
$newsCount->where('category_id', 'like', '%,' . $pid . ',%')
|
|
|
|
->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',$replacement,')")]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :查看是否编辑路由
|
|
|
|
* @name :editCategoryRoute
|
|
|
|
* @author :lyh
|
...
|
...
|
|