update
This commit is contained in:
@ -225,18 +225,37 @@ class KeywordsController extends AbstractController
|
|||||||
$v['created_at'] = date('Y-m-d H:i:s', $v['created_at']);
|
$v['created_at'] = date('Y-m-d H:i:s', $v['created_at']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$toutiaoPC = AppKeywordsMonitorResult::query()
|
||||||
|
->where('is_delete', 0)
|
||||||
|
->where('platform', 3)
|
||||||
|
->where('created_at', '>', strtotime('today'))
|
||||||
|
->orderBy('aid', 'desc')
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
foreach ($toutiaoPC 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') . '关键词监控结果';
|
$fileName = date('Y-m-d') . '关键词监控结果';
|
||||||
$exportList = [];
|
$exportList = [];
|
||||||
// 百度PC非负率
|
// 百度PC负面率
|
||||||
$total = AppKeywordsMonitorTask::query()->where('is_delete', 0)->where('platform', 1)->sum('length') ?: 1;
|
$total = AppKeywordsMonitorTask::query()->where('is_delete', 0)->where('platform', 1)->sum('length') ?: 1;
|
||||||
$percent = round(count($baiduPCRes) / $total, 2) * 100;
|
$percent = round(count($baiduPCRes) / $total, 2) * 100;
|
||||||
$exportList["百度PC端_$percent%"] = $baiduPCRes;
|
$exportList["百度PC端_$percent%"] = $baiduPCRes;
|
||||||
|
|
||||||
// 百度WAP非负率
|
// 百度WAP负面率
|
||||||
$total = AppKeywordsMonitorTask::query()->where('is_delete', 0)->where('platform', 2)->sum('length') ?: 1;
|
$total = AppKeywordsMonitorTask::query()->where('is_delete', 0)->where('platform', 2)->sum('length') ?: 1;
|
||||||
$percent = round(count($baiduWAPRes) / $total, 2) * 100;
|
$percent = round(count($baiduWAPRes) / $total, 2) * 100;
|
||||||
$exportList["百度WAP端_$percent%"] = $baiduWAPRes;
|
$exportList["百度WAP端_$percent%"] = $baiduWAPRes;
|
||||||
|
|
||||||
|
// 头条PC端负面率
|
||||||
|
$total = AppKeywordsMonitorTask::query()->where('is_delete', 0)->where('platform', 3)->sum('length') ?: 1;
|
||||||
|
$percent = round(count($toutiaoPC) / $total, 2) * 100;
|
||||||
|
$exportList["头条PC端_$percent%"] = $toutiaoPC;
|
||||||
|
|
||||||
return ExcelHelper::exportData($this->response, list: $exportList, header: [
|
return ExcelHelper::exportData($this->response, list: $exportList, header: [
|
||||||
['关键词', 'keyword', 'text'],
|
['关键词', 'keyword', 'text'],
|
||||||
['标题', 'title', 'text'],
|
['标题', 'title', 'text'],
|
||||||
|
Reference in New Issue
Block a user