作者 lyh

gx

@@ -555,20 +555,23 @@ class OptimizeController extends BaseController @@ -555,20 +555,23 @@ class OptimizeController extends BaseController
555 ], [ 555 ], [
556 'project_id.required' => '项目id不能为空', 556 'project_id.required' => '项目id不能为空',
557 ]); 557 ]);
  558 + $domainModel = new DomainInfo();
  559 + $domainInfo = $domainModel->read(['project_id'=>$this->param['project_id']],['domain']);
  560 + if($domainInfo === false){
  561 + $this->response('success');
  562 + }
558 ProjectServer::useProject($this->param['project_id']); 563 ProjectServer::useProject($this->param['project_id']);
559 $aiBlogModel = new AiBlog(); 564 $aiBlogModel = new AiBlog();
560 - $list = $aiBlogModel->formatQuery(['route'=>['!=',null]])->pluck('route')->toArray(); 565 + $list = $aiBlogModel->list(['route'=>['!=',null]],'id',['route','title']);
561 if(!empty($list)){ 566 if(!empty($list)){
562 - $domainModel = new DomainInfo();  
563 - $DomainInfo = $domainModel->read(['project_id'=>$this->param['project_id']]); 567 + $resultData = [];
564 $DomainInfo['domain'] = $DomainInfo['domain'] ?? ''; 568 $DomainInfo['domain'] = $DomainInfo['domain'] ?? '';
565 - foreach ($list as $k => $v){  
566 - $v = ('https://'.$DomainInfo['domain'].'/') . 'blog/' . $v;  
567 - $list[$k] = $v; 569 + foreach ($list as $v){
  570 + $resultData[] = ('https://'.$DomainInfo['domain'].'/') . 'blog/' . $v['route'] . '/{' . $v['title'] . '}';
568 } 571 }
569 } 572 }
570 DB::disconnect('custom_mysql'); 573 DB::disconnect('custom_mysql');
571 - $this->response('success',Code::SUCCESS,$list); 574 + $this->response('success',Code::SUCCESS,$resultData);
572 } 575 }
573 576
574 /** 577 /**