|
@@ -93,32 +93,50 @@ class GeoQuestionResLogic extends BaseLogic |
|
@@ -93,32 +93,50 @@ class GeoQuestionResLogic extends BaseLogic |
|
93
|
$core_question_count = $questionTotalCount = $urlTotalCount = $keywordsTotalCount = 0;
|
93
|
$core_question_count = $questionTotalCount = $urlTotalCount = $keywordsTotalCount = 0;
|
|
94
|
$keywordArr = [];
|
94
|
$keywordArr = [];
|
|
95
|
$questionLogModel = new GeoQuestionLog();
|
95
|
$questionLogModel = new GeoQuestionLog();
|
|
96
|
- $keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0]]);
|
|
|
|
97
|
- $coreKeywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'label'=>['like','%核心问题%'],'hit'=>['!=',0]]);
|
|
|
|
98
|
- foreach ($list as $item){
|
|
|
|
99
|
- $questionTotalCount += count($item['question'] ?? []);
|
|
|
|
100
|
- //核心问题数
|
|
|
|
101
|
- if(strpos($item['label'],'核心问题') !== false){
|
|
|
|
102
|
- $core_question_count += count($item['question'] ?? []);
|
96
|
+ if($this->user['project_id'] == 4533){
|
|
|
|
97
|
+ $keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'hit'=>['!=',0]]);
|
|
|
|
98
|
+ foreach ($list as $item){
|
|
|
|
99
|
+ $questionTotalCount += count($item['question'] ?? []);
|
|
|
|
100
|
+ //核心问题数
|
|
|
|
101
|
+ if(strpos($item['label'],'核心问题') !== false){
|
|
|
|
102
|
+ $core_question_count += count($item['question'] ?? []);
|
|
|
|
103
|
+ }
|
|
|
|
104
|
+ foreach ($item['keywords'] as $keyWordItem){
|
|
|
|
105
|
+ if (!array_key_exists($keyWordItem, $keywordArr)) {
|
|
|
|
106
|
+ $keywordArr[$keyWordItem] = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'keywords'=>['like','%"'.$keyWordItem.'"%']]);
|
|
|
|
107
|
+ }
|
|
|
|
108
|
+ }
|
|
103
|
}
|
109
|
}
|
|
104
|
- $keywordsTotalCount += count($item['keywords'] ?? []);
|
|
|
|
105
|
- $urlTotalCount += count($item['url'] ?? []);
|
|
|
|
106
|
- foreach ($item['keywords'] as $keyWordItem){
|
|
|
|
107
|
- if (!array_key_exists($keyWordItem, $keywordArr)) {
|
|
|
|
108
|
- $keywordArr[$keyWordItem] = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'keywords'=>['like','%"'.$keyWordItem.'"%']]);
|
110
|
+ $coreKeywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'label'=>['like','%核心问题%'],'is_match'=>1,'hit'=>['!=',0]]);
|
|
|
|
111
|
+ $data = [
|
|
|
|
112
|
+ 'question_count'=>$questionTotalCount,//问题总数
|
|
|
|
113
|
+ 'core_question_count'=>$core_question_count,//核心问题总数
|
|
|
|
114
|
+ 'keywords_url_count'=>$keywordUrlCount,
|
|
|
|
115
|
+ 'keywords_arr' => $keywordArr,
|
|
|
|
116
|
+ 'core_keyword_url_count'=>$coreKeywordUrlCount ?? 0
|
|
|
|
117
|
+ ];
|
|
|
|
118
|
+ return $this->success($data);
|
|
|
|
119
|
+ }else{
|
|
|
|
120
|
+ $keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0]]);
|
|
|
|
121
|
+ foreach ($list as $item){
|
|
|
|
122
|
+ $questionTotalCount += count($item['question'] ?? []);
|
|
|
|
123
|
+ $keywordsTotalCount += count($item['keywords'] ?? []);
|
|
|
|
124
|
+ $urlTotalCount += count($item['url'] ?? []);
|
|
|
|
125
|
+ foreach ($item['keywords'] as $keyWordItem){
|
|
|
|
126
|
+ if (!array_key_exists($keyWordItem, $keywordArr)) {
|
|
|
|
127
|
+ $keywordArr[$keyWordItem] = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'keywords'=>['like','%"'.$keyWordItem.'"%']]);
|
|
|
|
128
|
+ }
|
|
109
|
}
|
129
|
}
|
|
110
|
}
|
130
|
}
|
|
|
|
131
|
+ $data = [
|
|
|
|
132
|
+ 'question_count'=>$questionTotalCount,
|
|
|
|
133
|
+ 'keywords_count'=>$keywordsTotalCount,
|
|
|
|
134
|
+ 'url_count'=>$urlTotalCount,
|
|
|
|
135
|
+ 'keywords_url_count'=>$keywordUrlCount,
|
|
|
|
136
|
+ 'keywords_arr' => $keywordArr,
|
|
|
|
137
|
+ ];
|
|
|
|
138
|
+ return $this->success($data);
|
|
111
|
}
|
139
|
}
|
|
112
|
- $data = [
|
|
|
|
113
|
- 'keywords_count'=>$keywordsTotalCount,
|
|
|
|
114
|
- 'url_count'=>$urlTotalCount,
|
|
|
|
115
|
- 'question_count'=>$questionTotalCount,
|
|
|
|
116
|
- 'keywords_url_count'=>$keywordUrlCount,
|
|
|
|
117
|
- 'keywords_arr' => $keywordArr,
|
|
|
|
118
|
- 'core_question_count'=>$core_question_count,
|
|
|
|
119
|
- 'core_keyword_url_count'=>$coreKeywordUrlCount
|
|
|
|
120
|
- ];
|
|
|
|
121
|
- return $this->success($data);
|
|
|
|
122
|
}
|
140
|
}
|
|
123
|
|
141
|
|
|
124
|
/**
|
142
|
/**
|
|
@@ -134,7 +152,11 @@ class GeoQuestionResLogic extends BaseLogic |
|
@@ -134,7 +152,11 @@ class GeoQuestionResLogic extends BaseLogic |
|
134
|
$list = $platformModel->list(['status'=>1],'id',['name','en_name']);
|
152
|
$list = $platformModel->list(['status'=>1],'id',['name','en_name']);
|
|
135
|
$questionResModel = new GeoQuestionLog();
|
153
|
$questionResModel = new GeoQuestionLog();
|
|
136
|
foreach ($list as $item){
|
154
|
foreach ($list as $item){
|
|
137
|
- $data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0],'platform'=>$item['en_name']]);
|
155
|
+ if($this->user['project_id'] == 4533){
|
|
|
|
156
|
+ $data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'hit'=>['!=',0],'platform'=>$item['en_name']]);
|
|
|
|
157
|
+ }else{
|
|
|
|
158
|
+ $data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0],'platform'=>$item['en_name']]);
|
|
|
|
159
|
+ }
|
|
138
|
}
|
160
|
}
|
|
139
|
return $this->success($data);
|
161
|
return $this->success($data);
|
|
140
|
}
|
162
|
}
|