作者 刘锟

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

... ... @@ -54,12 +54,13 @@ class WeekProject extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']);
$list = $projectModel->list(['delete_status'=>0,'id'=>['<',2000],'type'=>['in',[1,2,3,4,6]]],'id',['id','title']);
$domainModel = new DomainInfo();
foreach ($list as $k => $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
$domainInfo = $domainModel->read(['project_id'=>$v['id']]);
if($domainInfo === false){
echo date('Y-m-d H:i:s') . '域名不存在,跳过:'.$v['title'] . PHP_EOL;
continue;
}
$v['domain'] = $domainInfo['domain'];
... ... @@ -93,11 +94,17 @@ class WeekProject extends Command
$countModel = new Count();
$startOfThisWeek = date('Y-m-d', strtotime("monday this week"));
$endOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfThisWeek,'project_id'=>$value['id']],['inquiry_num','country']);
$data['inquiry_total'] = $endOfLastWeekFormattedInfo['inquiry_num'] ?? 0;//询盘数量
$data['inquiry_country'] = $endOfLastWeekFormattedInfo['country'] ?? json_encode([]);
$data['inquiry_total'] = $endOfLastWeekFormattedInfo['inquiry_num'] ?? 0;//询盘总数量
$data['inquiry_country'] = $endOfLastWeekFormattedInfo['country'] ?? json_encode([]);//询盘国家
//获取上一周询盘数量
$result = (new FormGlobalsoApi())->getDateInquiry($value['domain'],$data['start_date'],$data['end_date']);
$data['week_inquiry_total'] = ($endOfLastWeekFormattedInfo['inquiry_num'] ?? 0) - ($startOfLastWeekFormattedInfo['inquiry_num'] ?? 0);
if(isset($result['status'])){
$data['week_inquiry_total'] = $result['data'];
echo date('Y-m-d H:i:s') . '项目id:'.$value['id'].',域名:'.$value['domain'].',上周询盘数量data:'.$result['data'] . PHP_EOL;
}else{
$data['week_inquiry_total'] = 0;
echo date('Y-m-d H:i:s') . '项目id:'.$value['id'].',域名:'.$value['domain'].',请求询盘错误。' . PHP_EOL;
}
$rankDataModel = new RankData();
$rankInfo = $rankDataModel->read(['project_id'=>$value['id'],'lang'=>''],['first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num','indexed_pages_num']);
$data['google_indexed_num'] = $rankInfo['indexed_pages_num'] ?? 0;
... ... @@ -124,13 +131,12 @@ class WeekProject extends Command
//日均访问量
$data['daily_average_num'] = 0;
$pv_num_count = $countModel->where('project_id',$value['id'])->whereBetween('date', [$startOfLastWeekFormatted,$endOfLastWeekFormatted])->sum('pv_num');
echo date('Y-m-d H:i:s') . 'pv总量:'.$pv_num_count . PHP_EOL;
if($pv_num_count != 0){
$data['daily_average_num'] = round($pv_num_count / 7,2);
}
$v6WeeklyReportModel = new V6WeeklyReport();
$v6WeeklyReportModel->add($data);
$this->workChatMessage($data,$value['id']);
// $this->workChatMessage($data,$value['id']);
return true;
}
... ... @@ -246,6 +252,7 @@ class WeekProject extends Command
$content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
}
$arr[] = $content4;
$content = '';
foreach ($arr as $key => $val){
$content .= ($key + 1) .','.$val.PHP_EOL;
}
... ...
... ... @@ -209,7 +209,6 @@ class FormGlobalsoApi
$queryString = http_build_query($data);
$url = 'https://www.globalso.site/api/external-interface/country_con/15243d63ed5a5738?'.$queryString;
$res = http_get($url,['charset=utf-8']);
echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
return $res;
}
... ... @@ -234,7 +233,6 @@ class FormGlobalsoApi
$queryString = http_build_query($data);
$url = 'https://www.globalso.site/api/external-interface/date_count?'.$queryString;
$res = http_get($url,['charset=utf-8']);
echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
return $res;
}
}
... ...
... ... @@ -40,15 +40,8 @@ class TestController extends BaseController
* @time :2025/2/13 16:34
*/
public function ceshi(){
// 上一周的开始时间(周一 00:00:00)
$startOfLastWeek = strtotime("last week monday");
// 上一周的结束时间(周日 23:59:59)
$endOfLastWeek = strtotime("last week sunday 23:59:59");
// 格式化为日期时间字符串
$data['start_date'] = $startOfLastWeekFormatted = date('Y-m-d', $startOfLastWeek);
$data['end_date'] = $endOfLastWeekFormatted = date('Y-m-d', $endOfLastWeek);
//获取上一周询盘数量
$result = (new FormGlobalsoApi())->getDateInquiry('www.rzalubottle.com',$data['start_date'],$data['end_date']);
$result = (new FormGlobalsoApi())->getDateInquiry($this->param['domain'],$this->param['start'],$this->param['end']);
$this->response('success',Code::SUCCESS,$result);
}
}
... ...