作者 lyh

gx

... ... @@ -72,9 +72,12 @@ class BlogCategoryLogic extends BaseLogic
//随机获取最后一级id
$replacement = $this->getLastId($id);
if($blogCount > 0){
if($replacement == $pid){
$replacement = ',';
}
//存在博客时,移动所有博客到当前分类最后一级
$blogModel->where('category_id', 'like', '%,' . $pid . ',%')
->update(['category_id' => DB::raw("REPLACE(category_id, '$pid', '$replacement')")]);
->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', '$replacement')")]);
}
}
return $this->success();
... ...