|
...
|
...
|
@@ -93,14 +93,33 @@ 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]]);
|
|
|
|
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.'"%']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$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){
|
|
...
|
...
|
@@ -110,16 +129,15 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'question_count'=>$questionTotalCount,
|
|
|
|
'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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :按平台统计问题数量
|
|
...
|
...
|
@@ -134,8 +152,12 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
$list = $platformModel->list(['status'=>1],'id',['name','en_name']);
|
|
|
|
$questionResModel = new GeoQuestionLog();
|
|
|
|
foreach ($list as $item){
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|