|
...
|
...
|
@@ -2,15 +2,19 @@ |
|
|
|
|
|
|
|
namespace App\Http\Logic\Bside\HomeCount;
|
|
|
|
|
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\HomeCount\YesterdayCount;
|
|
|
|
use App\Models\HomeCount\Count;
|
|
|
|
use App\Models\RankData\RankData as RankDataModel;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class CountLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->model = new YesterdayCount();
|
|
|
|
$this->model = new Count();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -20,15 +24,148 @@ class CountLogic extends BaseLogic |
|
|
|
* @time :2023/5/23 17:30
|
|
|
|
*/
|
|
|
|
public function yesterday_count(){
|
|
|
|
$yesterday = now()->subDay();
|
|
|
|
$yesterday = Carbon::yesterday()->toDateString();
|
|
|
|
$param = [
|
|
|
|
'date' => $yesterday,
|
|
|
|
'project_id' => $this->user['project_id']
|
|
|
|
];
|
|
|
|
$info = $this->model->read($param);
|
|
|
|
$info = $this->model->read($param,['pv_num','ip_num','inquiry_num','date','compliance_day','service_day']);
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(方案信息)scheme_info
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/24 11:48
|
|
|
|
*/
|
|
|
|
public function scheme_info(){
|
|
|
|
$data = [
|
|
|
|
'company'=>$this->project['company'],
|
|
|
|
'scheme'=>$this->project['deploy_build']['plan'],
|
|
|
|
'service_duration'=>$this->project['deploy_build']['service_duration'],
|
|
|
|
];
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(总访问量)total_count
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/24 13:33
|
|
|
|
*/
|
|
|
|
public function total_count($inquiry_num){
|
|
|
|
$pv = DB::table('gl_customer_visit_item')->where(['domain'=>$this->project['deploy_build']['test_domain']])->count();
|
|
|
|
$ip = DB::table('gl_customer_visit')->where(['domain'=>$this->project['deploy_build']['test_domain']])->count();
|
|
|
|
$data = [
|
|
|
|
'total_pv'=>$pv,
|
|
|
|
'total_ip'=>$ip,
|
|
|
|
'conversion_rate' => ($inquiry_num / $ip) * 100,
|
|
|
|
];
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(前一天关键字排名统计)keyword_data
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/24 14:03
|
|
|
|
*/
|
|
|
|
public function keyword_data_count(){
|
|
|
|
$yesterday = Carbon::yesterday()->toDateString();
|
|
|
|
$rankDataModel = new RankDataModel();
|
|
|
|
$param = [
|
|
|
|
'updated_date' => $yesterday,
|
|
|
|
'project_id' => $this->user['project_id']
|
|
|
|
];
|
|
|
|
$data = $rankDataModel->read($param,['first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(相关数据统计)with_data_count
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/24 14:12
|
|
|
|
*/
|
|
|
|
public function with_data_count(){
|
|
|
|
$product_count = DB::table('gl_product')->where(['project_id' => $this->user['project_id']])->count();
|
|
|
|
$news_count = DB::table('gl_news')->where(['project_id' => $this->user['project_id']])->count();
|
|
|
|
$page_count = DB::table('gl_web_template')->where(['project_id' => $this->user['project_id']])->count();
|
|
|
|
$data = [
|
|
|
|
'product_count' => $product_count,
|
|
|
|
'news_count' => $news_count,
|
|
|
|
'page_count' => $page_count,
|
|
|
|
];
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(30天数据统计)visit_data_count
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/24 14:18
|
|
|
|
*/
|
|
|
|
public function visit_data_count(){
|
|
|
|
$param = [
|
|
|
|
'date' => ['between',[now()->subDays(30)->startOfDay()->toDateString(),now()->startOfDay()->toDateString()]],
|
|
|
|
'project_id' => $this->user['project_id']
|
|
|
|
];
|
|
|
|
$data = $this->model->list($param,'id',['id','pv_num','ip_num','date']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(询盘国家统计)inquiry_country_count
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/24 14:58
|
|
|
|
*/
|
|
|
|
public function inquiry_country_count(){
|
|
|
|
$data = DB::table('gl_xunpan_ipdata')
|
|
|
|
->select('ip_area', DB::raw('COUNT(ip_area) as count'))
|
|
|
|
->groupBy('ip_area')->orderBy('count','desc')->limit(20)->get()->toArray();
|
|
|
|
$data = object_to_array($data);
|
|
|
|
$total = DB::table('gl_xunpan_ipdata')->count();
|
|
|
|
foreach ($data as $k=>$v){
|
|
|
|
$data[$k]['proportion'] = ($v['count']/$total) * 100;
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(访问来源统计)referrer_count
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/24 15:32
|
|
|
|
*/
|
|
|
|
public function referrer_count(){
|
|
|
|
$data = DB::table('gl_customer_visit')
|
|
|
|
->select('referrer_url', DB::raw('COUNT(*) as count'))->groupBy('referrer_url')
|
|
|
|
->orderBy('count','desc')->limit(8)->get()->toArray();
|
|
|
|
$total = DB::table('gl_customer_visit')->count();
|
|
|
|
$data = object_to_array($data);
|
|
|
|
foreach ($data as $k=>$v){
|
|
|
|
$data[$k]['proportion'] = ($v['count']/$total) * 100;
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(访问国家统计)access_country_count
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/24 15:56
|
|
|
|
*/
|
|
|
|
public function access_country_count(){
|
|
|
|
$data = DB::table('gl_customer_visit')
|
|
|
|
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
|
|
|
|
->groupBy('country')->orderBy('ip','desc')->limit(20)->get()->toArray();
|
|
|
|
$data = object_to_array($data);
|
|
|
|
foreach ($data as $k => $v){
|
|
|
|
$v['pv'] = (int)$v['pv'];
|
|
|
|
$data[$k] = $v;
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|