|
...
|
...
|
@@ -50,7 +50,7 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
$filed = ['id','project_id','question_id','platform','question','en_question','keywords','url','created_at','updated_at'];
|
|
|
|
if(!empty($map['created_at'])){
|
|
|
|
$map['project_id'] = $this->user['project_id'];
|
|
|
|
$map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].'23:59:59']];
|
|
|
|
$map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']];
|
|
|
|
$this->model = new GeoQuestionLog();
|
|
|
|
}
|
|
|
|
$query = $this->model->formatQuery($map);
|
|
...
|
...
|
@@ -83,23 +83,22 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function countQuantity(){
|
|
|
|
$questionModel = new GeoQuestion();
|
|
|
|
$list = $questionModel->list(['project_id',$this->user['project_id']],['question','keywords','url']);
|
|
|
|
$list = $questionModel->list(['project_id'=>$this->user['project_id']],['question','keywords','url']);
|
|
|
|
$questionTotalCount = $urlTotalCount = $keywordsTotalCount = $keywordUrlCount = 0;
|
|
|
|
foreach ($list as $item){
|
|
|
|
$questionTotalCount += count($item['question'] ?? []);
|
|
|
|
$keywordsTotalCount += count($item['keywords'] ?? []);
|
|
|
|
$urlTotalCount += count($item['url'] ?? []);
|
|
|
|
}
|
|
|
|
$keywordUrlCount = 0;
|
|
|
|
$keywordArr = [];
|
|
|
|
$questionResModel = new GeoQuestionResult();
|
|
|
|
$resList = $questionResModel->list(['project_id',$this->user['project_id']],['keywords_num','url_num']);
|
|
|
|
$questionResModel = new GeoQuestionLog();
|
|
|
|
$resList = $questionResModel->list(['project_id'=>$this->user['project_id']],['keywords','url','keywords_num','url_num']);
|
|
|
|
foreach ($resList as $resItem){
|
|
|
|
$keywordsNumArr = json_decode($resItem['keywords_num'] ?? [], true); // 转为 PHP 关联数组
|
|
|
|
$keywordUrlCount += array_sum($keywordsNumArr); // 获取值的总和
|
|
|
|
$urlNumArr = json_decode($resItem['url'] ?? [],true);
|
|
|
|
$keywordUrlCount += array_sum($urlNumArr); // 获取值的总和
|
|
|
|
$keywordUrlCount += count($resItem['keywords']);
|
|
|
|
$keywordUrlCount += count($resItem['url']);
|
|
|
|
foreach ($resItem['keywords_num'] as $key => $value) {
|
|
|
|
$keywordArr[$key] = ($keywordArr[$key] ?? 0) + $value;
|
|
|
|
$keywordArr[$key] = ($keywordArr[$key] ?? 0) + (($value != 0) ? 1 : 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = [
|
...
|
...
|
|