|
...
|
...
|
@@ -13,6 +13,7 @@ use App\Models\Visit\Visit; |
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use App\Models\HomeCount\Count;
|
|
|
|
|
|
|
|
class UpgradeProjectCount extends Command
|
|
|
|
{
|
|
...
|
...
|
@@ -47,8 +48,67 @@ class UpgradeProjectCount extends Command |
|
|
|
$list = DB::connection('custom_mysql')->table('gl_customer_visit')->select('updated_date')
|
|
|
|
->groupBy('updated_date')->get()->toArray();
|
|
|
|
if(!empty($list)){
|
|
|
|
echo date('Y-m-d H:i:s') . '时间:'.json_encode($list) . PHP_EOL;
|
|
|
|
$arr = [];
|
|
|
|
foreach ($list as $k=>$v){
|
|
|
|
$this->country20Top($v['updated_date']);
|
|
|
|
// $count = new Count();
|
|
|
|
// $arr['project_id'] = 439;
|
|
|
|
// $arr['date'] = $v['updated_date'];
|
|
|
|
// $arr['pv_num'] = $this->pv_num($v['updated_date']);
|
|
|
|
// $arr['ip_num'] = $this->ip_num($v['updated_date']);
|
|
|
|
// $arr['inquiry_num'] = $this->inquiry_num($v['updated_date']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :询盘国家前20
|
|
|
|
* @name :country20Top
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/1/8 9:29
|
|
|
|
*/
|
|
|
|
public function country20Top($day){
|
|
|
|
$country = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
|
|
->whereDate('updated_date', $day)->where('inquiry_num',1)
|
|
|
|
->select('country', DB::raw('COUNT(*) as count'))
|
|
|
|
->groupBy('country')
|
|
|
|
->orderByDesc('count')->limit(20)->get()->toArray();
|
|
|
|
echo date('Y-m-d H:i:s') . '时间:'.json_encode($country) . PHP_EOL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :询盘数量
|
|
|
|
* @name :inquiry_num
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/1/8 9:24
|
|
|
|
*/
|
|
|
|
public function inquiry_num($day){
|
|
|
|
$count = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $day)->where('inquiry_num',1)->count();
|
|
|
|
return $count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(统计pv)pv_num
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/14 15:40
|
|
|
|
*/
|
|
|
|
public function pv_num($day){
|
|
|
|
$pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $day)->count();
|
|
|
|
return $pv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(统计ip)ip_num
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/14 15:40
|
|
|
|
*/
|
|
|
|
public function ip_num($day){
|
|
|
|
$ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $day)->count();
|
|
|
|
return $ip;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|