|
...
|
...
|
@@ -20,6 +20,7 @@ use App\Models\Product\Product; |
|
|
|
use App\Models\Project\DeployOptimize;
|
|
|
|
use App\Models\Project\OnlineCheck;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\Project\ProjectKeyword;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\User\User;
|
|
|
|
use App\Models\WebSetting\WebLanguage;
|
|
...
|
...
|
@@ -397,24 +398,26 @@ class PrivateController extends BaseController |
|
|
|
$this->response('当前域名不存在',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
ProjectServer::useProject($info['project_id']);
|
|
|
|
$keywordRelatedModel = new KeywordRelated();
|
|
|
|
$ids_arr = $keywordRelatedModel::distinct()->pluck('keyword_id')->toArray();
|
|
|
|
if(empty($ids_arr)){
|
|
|
|
$projectKeywordModel = new ProjectKeyword();
|
|
|
|
$keywordsInfo = $projectKeywordModel->read(['project_id'=>$info['project_id']],'customer_keywords');
|
|
|
|
$keywords_sts = trim($keywordsInfo['customer_keywords'],',');
|
|
|
|
if(!empty($keywords_sts)){
|
|
|
|
$productKeywordModel = new Keyword();
|
|
|
|
$list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->limit(50)->pluck('title','route')->toArray();
|
|
|
|
$this->response('success',Code::SUCCESS,$list);
|
|
|
|
}else{
|
|
|
|
$productKeywordModel = new Keyword();
|
|
|
|
$key_num = count($ids_arr);
|
|
|
|
if($key_num >= 50){
|
|
|
|
$list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->whereIn('id',$ids_arr)->limit(50)->pluck('title', 'route')->toArray();
|
|
|
|
$keywords_arr = explode(',',trim($keywords_sts,','));
|
|
|
|
$num = count($keywords_arr);
|
|
|
|
if($num >= 50){
|
|
|
|
$list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->whereIn('title',$keywords_arr)->limit(50)->pluck('title', 'route')->toArray();
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}else{
|
|
|
|
$list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->whereIn('id',$ids_arr)->pluck('title', 'route')->toArray();
|
|
|
|
$key_list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->limit(50 - $key_num)->pluck('title','route')->toArray();
|
|
|
|
$list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->whereIn('title',$keywords_arr)->pluck('title', 'route')->toArray();
|
|
|
|
$key_list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->limit(50 - $num)->pluck('title','route')->toArray();
|
|
|
|
$list = array_merge($key_list,$list);
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
$this->response('success',Code::SUCCESS,$list);
|
|
|
|
}else{
|
|
|
|
$productKeywordModel = new Keyword();
|
|
|
|
$list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->limit(50)->pluck('title','route')->toArray();
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
$this->response('success',Code::SUCCESS,$list);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|