正在显示
1 个修改的文件
包含
8 行增加
和
2 行删除
| @@ -72,12 +72,18 @@ class UpgradeProjectCount extends Command | @@ -72,12 +72,18 @@ class UpgradeProjectCount extends Command | ||
| 72 | * @time :2024/1/8 9:29 | 72 | * @time :2024/1/8 9:29 |
| 73 | */ | 73 | */ |
| 74 | public function country20Top($day){ | 74 | public function country20Top($day){ |
| 75 | - $country = DB::connection('custom_mysql')->table('gl_customer_visit') | 75 | + $country = []; |
| 76 | + $data = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 76 | ->whereDate('updated_date', $day)->where('is_inquiry',1) | 77 | ->whereDate('updated_date', $day)->where('is_inquiry',1) |
| 77 | ->select('country', DB::raw('COUNT(*) as count')) | 78 | ->select('country', DB::raw('COUNT(*) as count')) |
| 78 | ->groupBy('country') | 79 | ->groupBy('country') |
| 79 | ->orderByDesc('count')->limit(20)->get()->toArray(); | 80 | ->orderByDesc('count')->limit(20)->get()->toArray(); |
| 80 | - echo date('Y-m-d H:i:s') . 'shuju:'.json_encode($country) . PHP_EOL; | 81 | + if(!empty($data)){ |
| 82 | + foreach ($data as $v){ | ||
| 83 | + $country[$v['country']] = $v['count']; | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + echo date('Y-m-d H:i:s') . 'shuju:'.json_encode($country) . PHP_EOL; | ||
| 81 | } | 87 | } |
| 82 | 88 | ||
| 83 | /** | 89 | /** |
-
请 注册 或 登录 后发表评论