|
@@ -50,7 +50,7 @@ class GeoQuestionResLogic extends BaseLogic |
|
@@ -50,7 +50,7 @@ class GeoQuestionResLogic extends BaseLogic |
|
50
|
$filed = ['id','project_id','question_id','platform','question','en_question','keywords','url','created_at','updated_at'];
|
50
|
$filed = ['id','project_id','question_id','platform','question','en_question','keywords','url','created_at','updated_at'];
|
|
51
|
if(!empty($map['created_at'])){
|
51
|
if(!empty($map['created_at'])){
|
|
52
|
$map['project_id'] = $this->user['project_id'];
|
52
|
$map['project_id'] = $this->user['project_id'];
|
|
53
|
- $map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].'23:59:59']];
|
53
|
+ $map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']];
|
|
54
|
$this->model = new GeoQuestionLog();
|
54
|
$this->model = new GeoQuestionLog();
|
|
55
|
}
|
55
|
}
|
|
56
|
$query = $this->model->formatQuery($map);
|
56
|
$query = $this->model->formatQuery($map);
|
|
@@ -83,23 +83,22 @@ class GeoQuestionResLogic extends BaseLogic |
|
@@ -83,23 +83,22 @@ class GeoQuestionResLogic extends BaseLogic |
|
83
|
*/
|
83
|
*/
|
|
84
|
public function countQuantity(){
|
84
|
public function countQuantity(){
|
|
85
|
$questionModel = new GeoQuestion();
|
85
|
$questionModel = new GeoQuestion();
|
|
86
|
- $list = $questionModel->list(['project_id',$this->user['project_id']],['question','keywords','url']);
|
86
|
+ $list = $questionModel->list(['project_id'=>$this->user['project_id']],['question','keywords','url']);
|
|
87
|
$questionTotalCount = $urlTotalCount = $keywordsTotalCount = $keywordUrlCount = 0;
|
87
|
$questionTotalCount = $urlTotalCount = $keywordsTotalCount = $keywordUrlCount = 0;
|
|
88
|
foreach ($list as $item){
|
88
|
foreach ($list as $item){
|
|
89
|
$questionTotalCount += count($item['question'] ?? []);
|
89
|
$questionTotalCount += count($item['question'] ?? []);
|
|
90
|
$keywordsTotalCount += count($item['keywords'] ?? []);
|
90
|
$keywordsTotalCount += count($item['keywords'] ?? []);
|
|
91
|
$urlTotalCount += count($item['url'] ?? []);
|
91
|
$urlTotalCount += count($item['url'] ?? []);
|
|
92
|
}
|
92
|
}
|
|
|
|
93
|
+ $keywordUrlCount = 0;
|
|
93
|
$keywordArr = [];
|
94
|
$keywordArr = [];
|
|
94
|
- $questionResModel = new GeoQuestionResult();
|
|
|
|
95
|
- $resList = $questionResModel->list(['project_id',$this->user['project_id']],['keywords_num','url_num']);
|
95
|
+ $questionResModel = new GeoQuestionLog();
|
|
|
|
96
|
+ $resList = $questionResModel->list(['project_id'=>$this->user['project_id']],['keywords','url','keywords_num','url_num']);
|
|
96
|
foreach ($resList as $resItem){
|
97
|
foreach ($resList as $resItem){
|
|
97
|
- $keywordsNumArr = json_decode($resItem['keywords_num'] ?? [], true); // 转为 PHP 关联数组
|
|
|
|
98
|
- $keywordUrlCount += array_sum($keywordsNumArr); // 获取值的总和
|
|
|
|
99
|
- $urlNumArr = json_decode($resItem['url'] ?? [],true);
|
|
|
|
100
|
- $keywordUrlCount += array_sum($urlNumArr); // 获取值的总和
|
98
|
+ $keywordUrlCount += count($resItem['keywords']);
|
|
|
|
99
|
+ $keywordUrlCount += count($resItem['url']);
|
|
101
|
foreach ($resItem['keywords_num'] as $key => $value) {
|
100
|
foreach ($resItem['keywords_num'] as $key => $value) {
|
|
102
|
- $keywordArr[$key] = ($keywordArr[$key] ?? 0) + $value;
|
101
|
+ $keywordArr[$key] = ($keywordArr[$key] ?? 0) + (($value != 0) ? 1 : 0);
|
|
103
|
}
|
102
|
}
|
|
104
|
}
|
103
|
}
|
|
105
|
$data = [
|
104
|
$data = [
|