AuthorityScoreLogic.php
3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* @remark :
* @name :AuthorityScoreLogic.php
* @author :lyh
* @method :post
* @time :2025/7/1 11:15
*/
namespace App\Http\Logic\Bside\BCom;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiVideo;
use App\Models\RankData\RankDataBmseo;
use App\Models\SeoSetting\LinkData;
/**
* @remark :报表详情数据
* @name :AuthorityScoreLogic
* @author :lyh
* @method :post
* @time :2025/7/1 11:15
*/
class AuthorityScoreLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
}
/**
* @remark :获取当前项目日期的报表
* @name :LogicWhiteHatReportInfo
* @author :lyh
* @method :post
* @time :2025/7/1 11:43
*/
public function LogicAuthorityScoreInfo(){
$data = [];
$bSeoModel = new RankDataBmseo();
$bSeoInfo = $bSeoModel->read(['project_id'=>$this->user['project_id'],'lang'=>''],['first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num','indexed_pages_num']);
$data['rank'] = $bSeoInfo;
$parsedUrl = parse_url($this->user['domain']);
$domain = $parsedUrl['host'];
$url = 'https://www.cmer.site/api/domain/organic?domain='.$domain;
try {
$data['sem'] = http_get($url)['data'];
}catch (\Exception $e){
$data['sem'] = [];
}
$startTime = date('Y-m-01 00:00:00', strtotime($this->param['date']));
// 结束时间(当月最后一天)
$endTime = date('Y-m-t 23:59:59', strtotime($this->param['date']));
//当月ai_blog发布数量及链接
$aiBlogModel = new AiBlog();
$data['ai_blog']['count'] = $aiBlogModel->counts(['created_at'=>['between'=>[$startTime,$endTime]]]);
$aiRouteArr = $aiBlogModel->selectField(['created_at'=>['between'=>[$startTime,$endTime]]],'route');
if(!empty($aiRouteArr)){
foreach ($aiRouteArr as $k => $item){
$aiRouteArr[$k] = $this->user['domain'] . 'blog/' . $item;
}
}
$data['ai_blog']['link'] = $aiRouteArr;
//当月ai_video发布数量及链接
$aiVideoModel = new AiVideo();
$data['ai_video']['count'] =$aiVideoModel->counts(['created_at'=>['between'=>[$startTime,$endTime]]]);
$aiVideoRouteArr = $aiVideoModel->selectField(['created_at'=>['between'=>[$startTime,$endTime]]],'route');
if(!empty($aiVideoRouteArr)){
foreach ($aiVideoRouteArr as $kVideo => $itemVideo){
$aiVideoRouteArr[$kVideo] = $this->user['domain'] . 'video/' . $itemVideo;
}
}
$data['ai_video']['link'] = $aiVideoRouteArr;
//白帽关键字
$data['keyword']['count'] = 0;
$data['keyword']['link'] = [];
//外链发布条数
$linkDataModel = new LinkData();
$data['link_data']['count'] = $linkDataModel->counts(['send_time'=>['between'=>[$startTime,$endTime]]]);
$data['link_data']['total_count'] = $linkDataModel->count();
$data['link_data']['ten_count'] = $linkDataModel->count(['da'=>['between'=>[10,30]]]);
$data['link_data']['thirty_count'] = $linkDataModel->count(['da'=>['between'=>[30,50]]]);
$data['link_data']['fifty_count'] = $linkDataModel->count(['da'=>['>=',50]]);
return $this->success($data);
}
}