|
@@ -6,7 +6,9 @@ use App\Helper\FormGlobalsoApi; |
|
@@ -6,7 +6,9 @@ use App\Helper\FormGlobalsoApi; |
|
6
|
use App\Http\Logic\Bside\BaseLogic;
|
6
|
use App\Http\Logic\Bside\BaseLogic;
|
|
7
|
use App\Models\HomeCount\Count;
|
7
|
use App\Models\HomeCount\Count;
|
|
8
|
use App\Models\HomeCount\MonthCount;
|
8
|
use App\Models\HomeCount\MonthCount;
|
|
|
|
9
|
+use App\Models\Inquiry\InquiryOther;
|
|
9
|
use App\Models\Project\DeployOptimize;
|
10
|
use App\Models\Project\DeployOptimize;
|
|
|
|
11
|
+use App\Services\ProjectServer;
|
|
10
|
use Carbon\Carbon;
|
12
|
use Carbon\Carbon;
|
|
11
|
use Illuminate\Support\Facades\DB;
|
13
|
use Illuminate\Support\Facades\DB;
|
|
12
|
|
14
|
|
|
@@ -67,8 +69,8 @@ class MonthCountLogic extends BaseLogic |
|
@@ -67,8 +69,8 @@ class MonthCountLogic extends BaseLogic |
|
67
|
//数据详情
|
69
|
//数据详情
|
|
68
|
$data = $inquiry_list['data']['data'] ?? '';
|
70
|
$data = $inquiry_list['data']['data'] ?? '';
|
|
69
|
$arr['month_total'] = 0;
|
71
|
$arr['month_total'] = 0;
|
|
|
|
72
|
+ $countryArr = [];
|
|
70
|
if(isset($data) && !empty($data)){
|
73
|
if(isset($data) && !empty($data)){
|
|
71
|
- $countryArr = [];
|
|
|
|
72
|
foreach ($data as $v){
|
74
|
foreach ($data as $v){
|
|
73
|
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
|
75
|
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
|
|
74
|
$arr['month_total']++;
|
76
|
$arr['month_total']++;
|
|
@@ -76,14 +78,28 @@ class MonthCountLogic extends BaseLogic |
|
@@ -76,14 +78,28 @@ class MonthCountLogic extends BaseLogic |
|
76
|
if(isset($countryArr[$v['country']])){
|
78
|
if(isset($countryArr[$v['country']])){
|
|
77
|
$countryArr[$v['country']]++;
|
79
|
$countryArr[$v['country']]++;
|
|
78
|
}else{
|
80
|
}else{
|
|
79
|
- $countryArr[$v['country']] = 0;
|
81
|
+ $countryArr[$v['country']] = 1;
|
|
80
|
}
|
82
|
}
|
|
81
|
}
|
83
|
}
|
|
82
|
- arsort($countryArr);
|
|
|
|
83
|
- $top20 = array_slice($countryArr, 0, 15, true);
|
|
|
|
84
|
- $arr['country'] = $top20;
|
|
|
|
85
|
}
|
84
|
}
|
|
86
|
}
|
85
|
}
|
|
|
|
86
|
+ //加上其他询盘
|
|
|
|
87
|
+ ProjectServer::useProject($this->user['project_id']);
|
|
|
|
88
|
+ $arr['total'] += InquiryOther::count();
|
|
|
|
89
|
+ $arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count();
|
|
|
|
90
|
+ $countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime])
|
|
|
|
91
|
+ ->select("country",DB::raw('COUNT(*) as count'))
|
|
|
|
92
|
+ ->groupBy('country')->get()->toArray();
|
|
|
|
93
|
+ foreach ($countryData as $v1){
|
|
|
|
94
|
+ if(isset($countryArr[$v1['country']])){
|
|
|
|
95
|
+ $countryArr[$v1['country']] += $v1['count'];
|
|
|
|
96
|
+ }else{
|
|
|
|
97
|
+ $countryArr[$v1['country']] = $v1['count'];
|
|
|
|
98
|
+ }
|
|
|
|
99
|
+ }
|
|
|
|
100
|
+ arsort($countryArr);
|
|
|
|
101
|
+ $top20 = array_slice($countryArr, 0, 15, true);
|
|
|
|
102
|
+ $arr['country'] = $top20;
|
|
87
|
return $arr;
|
103
|
return $arr;
|
|
88
|
}
|
104
|
}
|
|
89
|
|
105
|
|