正在显示
1 个修改的文件
包含
61 行增加
和
1 行删除
| @@ -13,6 +13,7 @@ use App\Models\Visit\Visit; | @@ -13,6 +13,7 @@ use App\Models\Visit\Visit; | ||
| 13 | use App\Services\ProjectServer; | 13 | use App\Services\ProjectServer; |
| 14 | use Illuminate\Console\Command; | 14 | use Illuminate\Console\Command; |
| 15 | use Illuminate\Support\Facades\DB; | 15 | use Illuminate\Support\Facades\DB; |
| 16 | +use App\Models\HomeCount\Count; | ||
| 16 | 17 | ||
| 17 | class UpgradeProjectCount extends Command | 18 | class UpgradeProjectCount extends Command |
| 18 | { | 19 | { |
| @@ -47,8 +48,67 @@ class UpgradeProjectCount extends Command | @@ -47,8 +48,67 @@ class UpgradeProjectCount extends Command | ||
| 47 | $list = DB::connection('custom_mysql')->table('gl_customer_visit')->select('updated_date') | 48 | $list = DB::connection('custom_mysql')->table('gl_customer_visit')->select('updated_date') |
| 48 | ->groupBy('updated_date')->get()->toArray(); | 49 | ->groupBy('updated_date')->get()->toArray(); |
| 49 | if(!empty($list)){ | 50 | if(!empty($list)){ |
| 50 | - echo date('Y-m-d H:i:s') . '时间:'.json_encode($list) . PHP_EOL; | 51 | + $arr = []; |
| 52 | + foreach ($list as $k=>$v){ | ||
| 53 | + $this->country20Top($v['updated_date']); | ||
| 54 | +// $count = new Count(); | ||
| 55 | +// $arr['project_id'] = 439; | ||
| 56 | +// $arr['date'] = $v['updated_date']; | ||
| 57 | +// $arr['pv_num'] = $this->pv_num($v['updated_date']); | ||
| 58 | +// $arr['ip_num'] = $this->ip_num($v['updated_date']); | ||
| 59 | +// $arr['inquiry_num'] = $this->inquiry_num($v['updated_date']); | ||
| 60 | + } | ||
| 51 | } | 61 | } |
| 52 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 62 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 53 | } | 63 | } |
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * @remark :询盘国家前20 | ||
| 67 | + * @name :country20Top | ||
| 68 | + * @author :lyh | ||
| 69 | + * @method :post | ||
| 70 | + * @time :2024/1/8 9:29 | ||
| 71 | + */ | ||
| 72 | + public function country20Top($day){ | ||
| 73 | + $country = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 74 | + ->whereDate('updated_date', $day)->where('inquiry_num',1) | ||
| 75 | + ->select('country', DB::raw('COUNT(*) as count')) | ||
| 76 | + ->groupBy('country') | ||
| 77 | + ->orderByDesc('count')->limit(20)->get()->toArray(); | ||
| 78 | + echo date('Y-m-d H:i:s') . '时间:'.json_encode($country) . PHP_EOL; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * @remark :询盘数量 | ||
| 83 | + * @name :inquiry_num | ||
| 84 | + * @author :lyh | ||
| 85 | + * @method :post | ||
| 86 | + * @time :2024/1/8 9:24 | ||
| 87 | + */ | ||
| 88 | + public function inquiry_num($day){ | ||
| 89 | + $count = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $day)->where('inquiry_num',1)->count(); | ||
| 90 | + return $count; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * @name :(统计pv)pv_num | ||
| 95 | + * @author :lyh | ||
| 96 | + * @method :post | ||
| 97 | + * @time :2023/6/14 15:40 | ||
| 98 | + */ | ||
| 99 | + public function pv_num($day){ | ||
| 100 | + $pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $day)->count(); | ||
| 101 | + return $pv; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * @name :(统计ip)ip_num | ||
| 106 | + * @author :lyh | ||
| 107 | + * @method :post | ||
| 108 | + * @time :2023/6/14 15:40 | ||
| 109 | + */ | ||
| 110 | + public function ip_num($day){ | ||
| 111 | + $ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $day)->count(); | ||
| 112 | + return $ip; | ||
| 113 | + } | ||
| 54 | } | 114 | } |
-
请 注册 或 登录 后发表评论