作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -41,7 +41,7 @@ class DownloadProject extends Command
public function handle(){
$v6WeekModel = new V6WeeklyReport();
$lists = $v6WeekModel->list([],'id',['*'],'desc',100);
$lists = $v6WeekModel->list([],'id',['*'],'desc',2);
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
foreach ($lists as $data){
$this->workChatMessage($data,$data['project_id']);
... ... @@ -209,6 +209,7 @@ class DownloadProject extends Command
// }
public function workChatMessage($data,$project_id){
$data['main_lang_id'] = 8;
$arr = [];
$content = '';
$content1 = '';
... ... @@ -226,8 +227,10 @@ class DownloadProject extends Command
$country .= $k.',';
};
$country = trim($country,',');
if(!empty($country)){
$content1 .= '询盘主要来源于'.$country.'等国家地区';
}
}
$content1 .= '如有高质量客户,请您密切关注与跟进;';
}
if(!empty($content1)){
... ... @@ -236,14 +239,27 @@ 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 .= '谷歌收录量:'.$data['google_indexed_num'].'条,';
$content2 .= $title.'收录量:'.$data['google_indexed_num'].'条,';
}
if(!empty($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;
}
... ... @@ -174,8 +178,10 @@ class WeekProject extends Command
$country .= $k.',';
};
$country = trim($country,',');
if(!empty($country)){
$content1 .= '询盘主要来源于'.$country.'等国家地区';
}
}
$content1 .= '如有高质量客户,请您密切关注与跟进;';
}
if(!empty($content1)){
... ... @@ -184,14 +190,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'])){
//获取上一次的外链数
$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'].'个,';
}
... ...