|
...
|
...
|
@@ -4,11 +4,14 @@ namespace App\Console\Commands; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use App\Helper\FormGlobalsoApi;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\HomeCount\Count;
|
|
|
|
use App\Models\Inquiry\InquiryFormData;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use mysql_xdevapi\Exception;
|
|
|
|
|
|
...
|
...
|
@@ -56,12 +59,19 @@ class Test extends Command |
|
|
|
echo '未配置数据库' . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$test_domain = $project->deploy_build['test_domain'];
|
|
|
|
$domainInfo = new DomainInfo();
|
|
|
|
$info = $domainInfo->read(['id'=>$project->deploy_optimize['domain']]);
|
|
|
|
if($info !== false){
|
|
|
|
$test_domain = $info['domain'];
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
$list = Count::where('pv_num', 0)->get();
|
|
|
|
$list = Count::where('date', '2023-12-11')->where('project_id', $project->id)->get();
|
|
|
|
foreach ($list as $v){
|
|
|
|
$v->pv_num = $this->pv_num($v['date']);
|
|
|
|
//ip统计
|
|
|
|
$v->ip_num = $this->ip_num($v['date']);
|
|
|
|
$arr = $this->inquiry([],$test_domain, $v['id']);
|
|
|
|
$v->inquiry_num = $arr['inquiry_num'];
|
|
|
|
$v->country = $arr['country'];
|
|
|
|
$v->save();
|
|
|
|
echo $v['date'] . ':' . $v->pv_num .':'. $v->ip_num . PHP_EOL;
|
|
|
|
}
|
|
...
|
...
|
@@ -72,25 +82,40 @@ class Test extends Command |
|
|
|
echo "finish";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(统计pv)pv_num
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/14 15:40
|
|
|
|
*/
|
|
|
|
public function pv_num($yesterday){
|
|
|
|
$pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->count();
|
|
|
|
return $pv;
|
|
|
|
public function inquiry($arr,$domain,$project_id){
|
|
|
|
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
|
|
|
|
if($inquiry_list['status'] == 400){
|
|
|
|
$arr['inquiry_num'] = 0;
|
|
|
|
$countryArr = [];
|
|
|
|
}else{
|
|
|
|
$arr['inquiry_num'] = $inquiry_list['data']['total'];
|
|
|
|
//询盘国家统计
|
|
|
|
$countryData = $inquiry_list['data']['data'];
|
|
|
|
$countryArr = [];
|
|
|
|
foreach ($countryData as $v1){
|
|
|
|
if(isset($countryArr[$v1['country']])){
|
|
|
|
$countryArr[$v1['country']]++;
|
|
|
|
}else{
|
|
|
|
$countryArr[$v1['country']] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(统计ip)ip_num
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/14 15:40
|
|
|
|
*/
|
|
|
|
public function ip_num($yesterday){
|
|
|
|
$ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $yesterday)->count();
|
|
|
|
return $ip;
|
|
|
|
//加上其他询盘
|
|
|
|
$arr['inquiry_num'] += InquiryFormData::getCount();
|
|
|
|
$countryData = InquiryFormData::getCountryCount();
|
|
|
|
foreach ($countryData as $v1){
|
|
|
|
if(isset($countryArr[$v1['country']])){
|
|
|
|
$countryArr[$v1['country']] += $v1['count'];
|
|
|
|
}else{
|
|
|
|
$countryArr[$v1['country']] = $v1['count'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
arsort($countryArr);
|
|
|
|
$top20 = array_slice($countryArr, 0, 20, true);
|
|
|
|
$arr['country'] = json_encode($top20);
|
|
|
|
return $arr;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|