|
...
|
...
|
@@ -10,6 +10,7 @@ |
|
|
|
namespace App\Http\Logic\Bside\Geo;
|
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Geo\GeoCount;
|
|
|
|
use App\Models\Geo\GeoPlatform;
|
|
|
|
use App\Models\Geo\GeoQuestion;
|
|
|
|
use App\Models\Geo\GeoQuestionLog;
|
|
...
|
...
|
@@ -98,7 +99,7 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
$list = $questionModel->list(['project_id'=>$this->user['project_id']],['question','keywords','url']);
|
|
|
|
$core_question_count = $questionTotalCount = $urlTotalCount = $keywordsTotalCount = 0;
|
|
|
|
$keywordArr = [];
|
|
|
|
$questionLogModel = new GeoQuestionLog();
|
|
|
|
$questionLogModel = new GeoQuestionResult();
|
|
|
|
if($this->user['project_id'] == 4533){
|
|
|
|
$keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'hit'=>['!=',0]]);
|
|
|
|
foreach ($list as $item){
|
|
...
|
...
|
@@ -119,9 +120,8 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
'core_question_count'=>$core_question_count,//核心问题总数
|
|
|
|
'keywords_url_count'=>$keywordUrlCount,
|
|
|
|
'keywords_arr' => $keywordArr,
|
|
|
|
'core_keyword_url_count'=>$coreKeywordUrlCount ?? 0
|
|
|
|
'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){
|
|
...
|
...
|
@@ -141,8 +141,18 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
'keywords_url_count'=>$keywordUrlCount,
|
|
|
|
'keywords_arr' => $keywordArr,
|
|
|
|
];
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
//问题达标数据
|
|
|
|
$data['question_qualify_count'] = $questionLogModel->where('project_id', $this->user['project_id'])
|
|
|
|
->where('hit','!=',0)->whereIn('platform',['openai', 'gemini','google_ai_overview'])
|
|
|
|
->select(DB::raw('COUNT(DISTINCT question) as total'))
|
|
|
|
->value('total');
|
|
|
|
$latestCreatedAt = $questionLogModel
|
|
|
|
->where('project_id', $this->user['project_id'])
|
|
|
|
->orderBy('id', 'desc')
|
|
|
|
->value('created_at');
|
|
|
|
$data['date'] = $latestCreatedAt ? date('Y-m-d', strtotime($latestCreatedAt)) : null;
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -156,7 +166,7 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
$data = [];
|
|
|
|
$platformModel = new GeoPlatform();
|
|
|
|
$list = $platformModel->list(['status'=>1],'id',['name','en_name']);
|
|
|
|
$questionResModel = new GeoQuestionLog();
|
|
|
|
$questionResModel = new GeoQuestionResult();
|
|
|
|
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']]);
|
|
...
|
...
|
@@ -196,4 +206,18 @@ class GeoQuestionResLogic extends BaseLogic |
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取图标数据
|
|
|
|
* @name :getPlatformCount
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/10/14 10:45
|
|
|
|
*/
|
|
|
|
public function getPlatformCount()
|
|
|
|
{
|
|
|
|
$geoCountModel = new GeoCount();
|
|
|
|
$lists = $geoCountModel->list(['project_id'=>$this->user['project_id']],'date',['*'],'desc',30);
|
|
|
|
return $this->success($lists);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|