作者 lyh

gx脚本

... ... @@ -236,14 +236,30 @@ class DownloadProject extends Command
$content2 = '';
if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){
$content2 .= '项目截止目前';
if($data['main_lang_id'] == 8){
$title = 'Yandex';
}else{
$title = '谷歌';
}
if(!empty($data['google_indexed_num'])){
$content2 .= $title.'收录量:'.$data['google_indexed_num'].'条,';
}
if(!empty($data['google_indexed_num'])){
$content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,';
$content2 .= $title.'收录量:'.$data['google_indexed_num'].'条,';
}
if(!empty($data['google_links_num'])){
$content2 .= '外链量:'.$data['google_links_num'].'条,';
//获取上一次的外链数
$latestRecord = V6WeeklyReport::where(['project_id'=>$project_id])->orderBy('id', 'desc')->first();
if(!empty($latestRecord)){
if($latestRecord['google_links_num'] != $data['google_links_num']){
$content2 .= '外链量:'.$data['google_links_num'].'条,';
}
}else{
$content2 .= '外链量:'.$data['google_links_num'].'条,';
}
}
if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){
$content2 .= '谷歌搜索排名';
$content2 .= $title.'搜索排名';
if(!empty($data['keyword_home_num'])){
$content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,';
}
... ...
... ... @@ -54,7 +54,7 @@ class WeekProject extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['delete_status'=>0,'is_weekly_report'=>1,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']);
$list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]],'id',['id','title','is_weekly_report','main_lang_id']);
$domainModel = new DomainInfo();
foreach ($list as $k => $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
... ... @@ -83,6 +83,7 @@ class WeekProject extends Command
$data = [
'project_id'=>$value['id'],
'title'=>$value['title'],
'main_lang_id'=>$value['main_lang_id'],
];
// 上一周的开始时间(周一 00:00:00)
$startOfLastWeek = strtotime("last week monday");
... ... @@ -134,9 +135,12 @@ class WeekProject extends Command
if($pv_num_count != 0){
$data['daily_average_num'] = round($pv_num_count / 7,2);
}
if($value['is_weekly_report'] != 0){
$this->workChatMessage($data,$value['id']);
}
$v6WeeklyReportModel = new V6WeeklyReport();
$v6WeeklyReportModel->add($data);
$this->workChatMessage($data,$value['id']);
return true;
}
... ... @@ -184,14 +188,27 @@ class WeekProject extends Command
$content2 = '';
if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){
$content2 .= '项目截止目前';
if($data['main_lang_id'] == 8){
$title = 'Yandex';
}else{
$title = '谷歌';
}
if(!empty($data['google_indexed_num'])){
$content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,';
$content2 .= $title.'收录量:'.$data['google_indexed_num'].'条,';
}
if(!empty($data['google_links_num'])){
$content2 .= '外链量:'.$data['google_links_num'].'条,';
//获取上一次的外链数
$latestRecord = V6WeeklyReport::where(['project_id'=>$project_id])->orderBy('id', 'desc')->first();
if(!empty($latestRecord)){
if($latestRecord['google_links_num'] != $data['google_links_num']){
$content2 .= '外链量:'.$data['google_links_num'].'条,';
}
}else{
$content2 .= '外链量:'.$data['google_links_num'].'条,';
}
}
if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){
$content2 .= '谷歌搜索排名';
$content2 .= $title.'搜索排名';
if(!empty($data['keyword_home_num'])){
$content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,';
}
... ...