正在显示
1 个修改的文件
包含
6 行增加
和
5 行删除
| @@ -46,6 +46,8 @@ class MonthCountLogic extends BaseLogic | @@ -46,6 +46,8 @@ class MonthCountLogic extends BaseLogic | ||
| 46 | $startTime = Carbon::now()->startOfMonth()->toDateString(); | 46 | $startTime = Carbon::now()->startOfMonth()->toDateString(); |
| 47 | $endTime = date('Y-m-d',time()); | 47 | $endTime = date('Y-m-d',time()); |
| 48 | $arr = []; | 48 | $arr = []; |
| 49 | + | ||
| 50 | + ProjectServer::useProject($this->user['project_id']); | ||
| 49 | $arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']); | 51 | $arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']); |
| 50 | $arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']); | 52 | $arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']); |
| 51 | $arr = $this->sourceCount($arr,$startTime,$endTime,$this->user['domain']); | 53 | $arr = $this->sourceCount($arr,$startTime,$endTime,$this->user['domain']); |
| @@ -84,7 +86,6 @@ class MonthCountLogic extends BaseLogic | @@ -84,7 +86,6 @@ class MonthCountLogic extends BaseLogic | ||
| 84 | } | 86 | } |
| 85 | } | 87 | } |
| 86 | //加上其他询盘 | 88 | //加上其他询盘 |
| 87 | - ProjectServer::useProject($this->user['project_id']); | ||
| 88 | $arr['total'] += InquiryOther::count(); | 89 | $arr['total'] += InquiryOther::count(); |
| 89 | $arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count(); | 90 | $arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count(); |
| 90 | $countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime]) | 91 | $countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime]) |
| @@ -134,21 +135,21 @@ class MonthCountLogic extends BaseLogic | @@ -134,21 +135,21 @@ class MonthCountLogic extends BaseLogic | ||
| 134 | */ | 135 | */ |
| 135 | public function sourceCount(&$arr,$startTime,$endTime,$domain){ | 136 | public function sourceCount(&$arr,$startTime,$endTime,$domain){ |
| 136 | //访问来源前10 | 137 | //访问来源前10 |
| 137 | - $source = DB::table('gl_customer_visit') | 138 | + $source = DB::connection('custom_mysql')->table('gl_customer_visit') |
| 138 | ->select('referrer_url', DB::raw('COUNT(*) as count')) | 139 | ->select('referrer_url', DB::raw('COUNT(*) as count')) |
| 139 | ->groupBy('referrer_url')->where(['domain'=>$domain]) | 140 | ->groupBy('referrer_url')->where(['domain'=>$domain]) |
| 140 | ->whereBetween('updated_date', [$startTime,$endTime]) | 141 | ->whereBetween('updated_date', [$startTime,$endTime]) |
| 141 | ->orderByDesc('count')->limit(10)->get()->toArray(); | 142 | ->orderByDesc('count')->limit(10)->get()->toArray(); |
| 142 | $arr['source'] = $source; | 143 | $arr['source'] = $source; |
| 143 | //访问国家前15 | 144 | //访问国家前15 |
| 144 | - $source_country = DB::table('gl_customer_visit') | 145 | + $source_country = DB::connection('custom_mysql')->table('gl_customer_visit') |
| 145 | ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) | 146 | ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) |
| 146 | ->groupBy('country')->where(['domain'=>$domain]) | 147 | ->groupBy('country')->where(['domain'=>$domain]) |
| 147 | ->whereBetween('updated_date', [$startTime,$endTime]) | 148 | ->whereBetween('updated_date', [$startTime,$endTime]) |
| 148 | ->orderBy('ip','desc')->limit(15)->get()->toArray(); | 149 | ->orderBy('ip','desc')->limit(15)->get()->toArray(); |
| 149 | $arr['source_country'] = $source_country; | 150 | $arr['source_country'] = $source_country; |
| 150 | //受访界面前15 | 151 | //受访界面前15 |
| 151 | - $referrer_url = DB::table('gl_customer_visit') | 152 | + $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit') |
| 152 | ->select('url',DB::raw('COUNT(*) as num')) | 153 | ->select('url',DB::raw('COUNT(*) as num')) |
| 153 | ->orderBy('num','desc')->where(['domain'=>$domain]) | 154 | ->orderBy('num','desc')->where(['domain'=>$domain]) |
| 154 | ->whereBetween('updated_date', [$startTime,$endTime]) | 155 | ->whereBetween('updated_date', [$startTime,$endTime]) |
| @@ -156,7 +157,7 @@ class MonthCountLogic extends BaseLogic | @@ -156,7 +157,7 @@ class MonthCountLogic extends BaseLogic | ||
| 156 | ->limit(15)->get()->toArray(); | 157 | ->limit(15)->get()->toArray(); |
| 157 | $arr['referrer_url'] = $referrer_url; | 158 | $arr['referrer_url'] = $referrer_url; |
| 158 | //访问断后 | 159 | //访问断后 |
| 159 | - $referrer_port = DB::table('gl_customer_visit') | 160 | + $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit') |
| 160 | ->select('device_port',DB::raw('COUNT(*) as num')) | 161 | ->select('device_port',DB::raw('COUNT(*) as num')) |
| 161 | ->orderBy('num','desc')->where(['domain'=>$domain]) | 162 | ->orderBy('num','desc')->where(['domain'=>$domain]) |
| 162 | ->whereBetween('updated_date', [$startTime,$endTime]) | 163 | ->whereBetween('updated_date', [$startTime,$endTime]) |
-
请 注册 或 登录 后发表评论