作者 lyh

gx

... ... @@ -129,25 +129,23 @@ class OnlineController extends BaseController
* @time :2023/8/18 10:58
*/
public function searchParam(&$query){
if(isset($this->map['id'])){
$query->where('gl_project.id',$this->map['id']);
}
if(!empty($this->map['message']) && !empty($this->map['type'])){
// 搜索域名
if($this->map['type'] == 'test_domain'){
$query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['message'].'%');
} else {
// 搜索名称
$query->where('gl_project.title', 'like', '%' . $this->map['message'] . '%');
}
}
if(isset($this->map['qa_status'])){
// 搜索状态
$query->where('gl_project_online_check.qa_status',$this->map['qa_status']);
}
if(isset($this->map['all_status'])){
// 搜索状态
$query->where('gl_project_online_check.qa_status',$this->map['all_status']);
}
if(isset($this->map['optimist_status'])){
// 搜索状态
$query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']);
}
$query = $query->where('gl_project.status',1);//TODO::已提交审核
... ...
... ... @@ -135,6 +135,7 @@ class CustomModuleCategoryLogic extends BaseLogic
public function categoryEdit(){
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],
$this->param['id'], $this->user['project_id']);
$this->editHandleCategory($this->param['id'],$this->param['pid']);
$this->editNewsRoute($this->param['id'],$route);
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
... ... @@ -153,12 +154,12 @@ class CustomModuleCategoryLogic extends BaseLogic
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){
$contentCount = $contentModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count();
if($contentCount > 0){
//随机获取最后一级id
$replacement = $this->getLastId($id);
//存在博客时,移动所有博客到当前分类最后一级
$contentModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%')
->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]);
... ... @@ -170,6 +171,22 @@ class CustomModuleCategoryLogic extends BaseLogic
}
/**
* @remark :随机获取当前id下最后一级的id
* @name :getLastId
* @author :lyh
* @method :post
* @time :2023/10/20 9:45
*/
public function getLastId($id){
$info = $this->model->read(['pid'=>$id],['id']);
if($info !== false){
return $this->getLastId($info['id']);
}else{
return $id;
}
}
/**
* @remark :查看是否编辑路由
* @name :editCategoryRoute
* @author :lyh
... ...