|
...
|
...
|
@@ -14,6 +14,7 @@ use App\Helper\Arr; |
|
|
|
use App\Helper\FormGlobalsoApi;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\HomeCount\Count;
|
|
|
|
use App\Models\HomeCount\MonthCount;
|
|
|
|
use App\Models\Inquiry\InquiryFormData;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\RankData\ExternalLinks;
|
|
...
|
...
|
@@ -115,7 +116,7 @@ class OptimizationReportController extends BaseController |
|
|
|
// 获取当前月的结束时间
|
|
|
|
$endTime = date('Y-m-t', strtotime($this->param['date']));
|
|
|
|
$arr = [];
|
|
|
|
$arr = $this->inquiryCount($arr,$startTime,$endTime,$domain);
|
|
|
|
$arr = $this->inquiryCount($arr,$startTime,$endTime,$domain,$project_id);
|
|
|
|
$arr = $this->flowCount($arr,$startTime,$endTime,$project_id);
|
|
|
|
$arr = $this->sourceCount($arr,$startTime,$endTime,$domain);
|
|
|
|
$arr['month'] = date('Y-m',time());
|
|
...
|
...
|
@@ -131,42 +132,15 @@ class OptimizationReportController extends BaseController |
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/30 14:29
|
|
|
|
*/
|
|
|
|
public function inquiryCount(&$arr,&$startTime,&$endTime,$domain){
|
|
|
|
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
|
|
|
|
if(!empty($inquiry_list)){
|
|
|
|
//总数
|
|
|
|
$arr['total'] = $inquiry_list['data']['total'] ?? 0;
|
|
|
|
//数据详情
|
|
|
|
$data = $inquiry_list['data']['data'] ?? '';
|
|
|
|
$arr['month_total'] = 0;
|
|
|
|
$countryArr = [];
|
|
|
|
if(isset($data) && !empty($data)){
|
|
|
|
foreach ($data as $v){
|
|
|
|
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
|
|
|
|
$arr['month_total']++;
|
|
|
|
if(isset($countryArr[$v['country']])){
|
|
|
|
$countryArr[$v['country']]++;
|
|
|
|
}else{
|
|
|
|
$countryArr[$v['country']] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//加上其他询盘
|
|
|
|
$arr['total'] += InquiryFormData::getCount();
|
|
|
|
$arr['month_total'] += InquiryFormData::getCount([$startTime, $endTime]);
|
|
|
|
$countryData = InquiryFormData::getCountryCount([$startTime, $endTime]);
|
|
|
|
foreach ($countryData as $v1){
|
|
|
|
if(isset($countryArr[$v1['country']])){
|
|
|
|
$countryArr[$v1['country']] += $v1['count'];
|
|
|
|
}else{
|
|
|
|
$countryArr[$v1['country']] = $v1['count'];
|
|
|
|
}
|
|
|
|
public function inquiryCount(&$arr, &$startTime, $project_id){
|
|
|
|
$month = date('Y-m',strtotime($startTime));
|
|
|
|
$monthCountModel = new MonthCount();
|
|
|
|
$info = $monthCountModel->read(['project_id'=>$project_id,'month'=>$month]);
|
|
|
|
if($info !== false){
|
|
|
|
$arr['country'] = $info['country'];
|
|
|
|
$arr['total'] = $info['total'];
|
|
|
|
$arr['month_total'] = $info['month_total'];
|
|
|
|
}
|
|
|
|
arsort($countryArr);
|
|
|
|
$top20 = array_slice($countryArr, 0, 15, true);
|
|
|
|
$arr['country'] = $top20;
|
|
|
|
return $arr;
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -350,9 +324,9 @@ class OptimizationReportController extends BaseController |
|
|
|
public function pv_ip($domain){
|
|
|
|
$pv = (new VisitItem())->count();
|
|
|
|
$ip = (new Visit())->count();
|
|
|
|
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
|
|
|
|
$inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
|
|
|
|
if(!empty($inquiry_list)){
|
|
|
|
$total = $inquiry_list['data']['total'] ?? 0;
|
|
|
|
$total = $inquiry_list['data']['count'] ?? 0;
|
|
|
|
}
|
|
|
|
return [
|
|
|
|
'total_pv'=>$pv,
|
...
|
...
|
|