作者 lyh

gx

@@ -129,25 +129,23 @@ class OnlineController extends BaseController @@ -129,25 +129,23 @@ class OnlineController extends BaseController
129 * @time :2023/8/18 10:58 129 * @time :2023/8/18 10:58
130 */ 130 */
131 public function searchParam(&$query){ 131 public function searchParam(&$query){
  132 + if(isset($this->map['id'])){
  133 + $query->where('gl_project.id',$this->map['id']);
  134 + }
132 if(!empty($this->map['message']) && !empty($this->map['type'])){ 135 if(!empty($this->map['message']) && !empty($this->map['type'])){
133 - // 搜索域名  
134 if($this->map['type'] == 'test_domain'){ 136 if($this->map['type'] == 'test_domain'){
135 $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['message'].'%'); 137 $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['message'].'%');
136 } else { 138 } else {
137 - // 搜索名称  
138 $query->where('gl_project.title', 'like', '%' . $this->map['message'] . '%'); 139 $query->where('gl_project.title', 'like', '%' . $this->map['message'] . '%');
139 } 140 }
140 } 141 }
141 if(isset($this->map['qa_status'])){ 142 if(isset($this->map['qa_status'])){
142 - // 搜索状态  
143 $query->where('gl_project_online_check.qa_status',$this->map['qa_status']); 143 $query->where('gl_project_online_check.qa_status',$this->map['qa_status']);
144 } 144 }
145 if(isset($this->map['all_status'])){ 145 if(isset($this->map['all_status'])){
146 - // 搜索状态  
147 $query->where('gl_project_online_check.qa_status',$this->map['all_status']); 146 $query->where('gl_project_online_check.qa_status',$this->map['all_status']);
148 } 147 }
149 if(isset($this->map['optimist_status'])){ 148 if(isset($this->map['optimist_status'])){
150 - // 搜索状态  
151 $query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']); 149 $query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']);
152 } 150 }
153 $query = $query->where('gl_project.status',1);//TODO::已提交审核 151 $query = $query->where('gl_project.status',1);//TODO::已提交审核
@@ -135,6 +135,7 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -135,6 +135,7 @@ class CustomModuleCategoryLogic extends BaseLogic
135 public function categoryEdit(){ 135 public function categoryEdit(){
136 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'], 136 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],
137 $this->param['id'], $this->user['project_id']); 137 $this->param['id'], $this->user['project_id']);
  138 + $this->editHandleCategory($this->param['id'],$this->param['pid']);
138 $this->editNewsRoute($this->param['id'],$route); 139 $this->editNewsRoute($this->param['id'],$route);
139 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 140 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
140 if($rs === false){ 141 if($rs === false){
@@ -153,12 +154,12 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -153,12 +154,12 @@ class CustomModuleCategoryLogic extends BaseLogic
153 public function editHandleCategory($id,$pid){ 154 public function editHandleCategory($id,$pid){
154 $info = $this->model->read(['id'=>$id],['id','pid']); 155 $info = $this->model->read(['id'=>$id],['id','pid']);
155 if($info['pid'] != $pid){ 156 if($info['pid'] != $pid){
156 - //修改勒上级,先查看上级是否拥有博客 157 + //修改勒上级,先查看上级是否拥有产品
157 $contentModel = new CustomModuleContent(); 158 $contentModel = new CustomModuleContent();
158 - $newsCount = $contentModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count(); 159 + $contentCount = $contentModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count();
  160 + if($contentCount > 0){
159 //随机获取最后一级id 161 //随机获取最后一级id
160 $replacement = $this->getLastId($id); 162 $replacement = $this->getLastId($id);
161 - if($newsCount > 0){  
162 //存在博客时,移动所有博客到当前分类最后一级 163 //存在博客时,移动所有博客到当前分类最后一级
163 $contentModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%') 164 $contentModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%')
164 ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]); 165 ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]);
@@ -170,6 +171,22 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -170,6 +171,22 @@ class CustomModuleCategoryLogic extends BaseLogic
170 } 171 }
171 172
172 /** 173 /**
  174 + * @remark :随机获取当前id下最后一级的id
  175 + * @name :getLastId
  176 + * @author :lyh
  177 + * @method :post
  178 + * @time :2023/10/20 9:45
  179 + */
  180 + public function getLastId($id){
  181 + $info = $this->model->read(['pid'=>$id],['id']);
  182 + if($info !== false){
  183 + return $this->getLastId($info['id']);
  184 + }else{
  185 + return $id;
  186 + }
  187 + }
  188 +
  189 + /**
173 * @remark :查看是否编辑路由 190 * @remark :查看是否编辑路由
174 * @name :editCategoryRoute 191 * @name :editCategoryRoute
175 * @author :lyh 192 * @author :lyh