This commit is contained in:
toom1996
2025-06-26 14:46:20 +08:00
parent 52bec8c926
commit ba6847fa23

View File

@ -239,6 +239,20 @@ class KeywordsController extends AbstractController
$v['created_at'] = date('Y-m-d H:i:s', $v['created_at']);
}
$toutiaoWAP = AppKeywordsMonitorResult::query()
->where('is_delete', 0)
->where('platform', 4)
->where('created_at', '>', strtotime('today'))
->orderBy('aid', 'desc')
->get()
->toArray();
foreach ($toutiaoWAP as &$v) {
$v['keyword'] = AppKeywordsMonitorTask::find($v['aid'])->keyword;
$v['screen_path'] = Config::getDomain() . $v['screen_path'];
$v['created_at'] = date('Y-m-d H:i:s', $v['created_at']);
}
$fileName = date('Y-m-d') . '关键词监控结果';
$exportList = [];
// 百度PC负面率
@ -256,6 +270,11 @@ class KeywordsController extends AbstractController
$percent = round(count($toutiaoPC) / $total, 2) * 100;
$exportList["头条PC端_$percent%"] = $toutiaoPC;
// 头条WAP端负面率
$total = AppKeywordsMonitorTask::query()->where('is_delete', 0)->where('platform', 4)->sum('length') ?: 1;
$percent = round(count($toutiaoWAP) / $total, 2) * 100;
$exportList["头条WAP端_$percent%"] = $toutiaoWAP;
return ExcelHelper::exportData($this->response, list: $exportList, header: [
['关键词', 'keyword', 'text'],
['标题', 'title', 'text'],