|
...
|
...
|
@@ -48,7 +48,7 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function getResultList($map = [],$page = 1,$row = 20){
|
|
|
|
$map['project_id'] = $this->user['project_id'];
|
|
|
|
$filed = ['id','project_id','question_id','platform','is_match','question','en_question','keywords','url','label','created_at','updated_at'];
|
|
|
|
$filed = ['id','project_id','question_id','platform','is_match','question','en_question','keywords','url','label','cosine','created_at','updated_at'];
|
|
|
|
if(!empty($map['created_at'])){
|
|
|
|
$map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']];
|
|
|
|
$this->model = new GeoQuestionLog();
|
|
...
|
...
|
@@ -93,32 +93,50 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
$core_question_count = $questionTotalCount = $urlTotalCount = $keywordsTotalCount = 0;
|
|
|
|
$keywordArr = [];
|
|
|
|
$questionLogModel = new GeoQuestionLog();
|
|
|
|
$keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0]]);
|
|
|
|
$coreKeywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'label'=>['like','%核心问题%'],'hit'=>['!=',0]]);
|
|
|
|
foreach ($list as $item){
|
|
|
|
$questionTotalCount += count($item['question'] ?? []);
|
|
|
|
//核心问题数
|
|
|
|
if(strpos($item['label'],'核心问题') !== false){
|
|
|
|
$core_question_count += count($item['question'] ?? []);
|
|
|
|
if($this->user['project_id'] == 4533){
|
|
|
|
$keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'hit'=>['!=',0]]);
|
|
|
|
foreach ($list as $item){
|
|
|
|
$questionTotalCount += count($item['question'] ?? []);
|
|
|
|
//核心问题数
|
|
|
|
if(strpos($item['label'],'核心问题') !== false){
|
|
|
|
$core_question_count += count($item['question'] ?? []);
|
|
|
|
}
|
|
|
|
foreach ($item['keywords'] as $keyWordItem){
|
|
|
|
if (!array_key_exists($keyWordItem, $keywordArr)) {
|
|
|
|
$keywordArr[$keyWordItem] = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'keywords'=>['like','%"'.$keyWordItem.'"%']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$keywordsTotalCount += count($item['keywords'] ?? []);
|
|
|
|
$urlTotalCount += count($item['url'] ?? []);
|
|
|
|
foreach ($item['keywords'] as $keyWordItem){
|
|
|
|
if (!array_key_exists($keyWordItem, $keywordArr)) {
|
|
|
|
$keywordArr[$keyWordItem] = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'keywords'=>['like','%"'.$keyWordItem.'"%']]);
|
|
|
|
$coreKeywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'label'=>['like','%核心问题%'],'is_match'=>1,'hit'=>['!=',0]]);
|
|
|
|
$data = [
|
|
|
|
'question_count'=>$questionTotalCount,//问题总数
|
|
|
|
'core_question_count'=>$core_question_count,//核心问题总数
|
|
|
|
'keywords_url_count'=>$keywordUrlCount,
|
|
|
|
'keywords_arr' => $keywordArr,
|
|
|
|
'core_keyword_url_count'=>$coreKeywordUrlCount ?? 0
|
|
|
|
];
|
|
|
|
return $this->success($data);
|
|
|
|
}else{
|
|
|
|
$keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0]]);
|
|
|
|
foreach ($list as $item){
|
|
|
|
$questionTotalCount += count($item['question'] ?? []);
|
|
|
|
$keywordsTotalCount += count($item['keywords'] ?? []);
|
|
|
|
$urlTotalCount += count($item['url'] ?? []);
|
|
|
|
foreach ($item['keywords'] as $keyWordItem){
|
|
|
|
if (!array_key_exists($keyWordItem, $keywordArr)) {
|
|
|
|
$keywordArr[$keyWordItem] = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'keywords'=>['like','%"'.$keyWordItem.'"%']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'question_count'=>$questionTotalCount,
|
|
|
|
'keywords_count'=>$keywordsTotalCount,
|
|
|
|
'url_count'=>$urlTotalCount,
|
|
|
|
'keywords_url_count'=>$keywordUrlCount,
|
|
|
|
'keywords_arr' => $keywordArr,
|
|
|
|
];
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'keywords_count'=>$keywordsTotalCount,
|
|
|
|
'url_count'=>$urlTotalCount,
|
|
|
|
'question_count'=>$questionTotalCount,
|
|
|
|
'keywords_url_count'=>$keywordUrlCount,
|
|
|
|
'keywords_arr' => $keywordArr,
|
|
|
|
'core_question_count'=>$core_question_count,
|
|
|
|
'core_keyword_url_count'=>$coreKeywordUrlCount
|
|
|
|
];
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -134,7 +152,11 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
$list = $platformModel->list(['status'=>1],'id',['name','en_name']);
|
|
|
|
$questionResModel = new GeoQuestionLog();
|
|
|
|
foreach ($list as $item){
|
|
|
|
$data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0],'platform'=>$item['en_name']]);
|
|
|
|
if($this->user['project_id'] == 4533){
|
|
|
|
$data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'hit'=>['!=',0],'platform'=>$item['en_name']]);
|
|
|
|
}else{
|
|
|
|
$data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0],'platform'=>$item['en_name']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
...
|
...
|
|