|
...
|
...
|
@@ -90,12 +90,17 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
public function countQuantity(){
|
|
|
|
$questionModel = new GeoQuestion();
|
|
|
|
$list = $questionModel->list(['project_id'=>$this->user['project_id']],['question','keywords','url']);
|
|
|
|
$questionTotalCount = $urlTotalCount = $keywordsTotalCount = $keywordUrlCount = 0;
|
|
|
|
$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'] ?? []);
|
|
|
|
}
|
|
|
|
$keywordsTotalCount += count($item['keywords'] ?? []);
|
|
|
|
$urlTotalCount += count($item['url'] ?? []);
|
|
|
|
foreach ($item['keywords'] as $keyWordItem){
|
|
...
|
...
|
@@ -110,7 +115,10 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
'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);
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|