|
...
|
...
|
@@ -6,7 +6,9 @@ use App\Helper\FormGlobalsoApi; |
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\HomeCount\Count;
|
|
|
|
use App\Models\HomeCount\MonthCount;
|
|
|
|
use App\Models\Inquiry\InquiryOther;
|
|
|
|
use App\Models\Project\DeployOptimize;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
...
|
...
|
@@ -67,8 +69,8 @@ class MonthCountLogic extends BaseLogic |
|
|
|
//数据详情
|
|
|
|
$data = $inquiry_list['data']['data'] ?? '';
|
|
|
|
$arr['month_total'] = 0;
|
|
|
|
$countryArr = [];
|
|
|
|
if(isset($data) && !empty($data)){
|
|
|
|
$countryArr = [];
|
|
|
|
foreach ($data as $v){
|
|
|
|
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
|
|
|
|
$arr['month_total']++;
|
|
...
|
...
|
@@ -76,14 +78,28 @@ class MonthCountLogic extends BaseLogic |
|
|
|
if(isset($countryArr[$v['country']])){
|
|
|
|
$countryArr[$v['country']]++;
|
|
|
|
}else{
|
|
|
|
$countryArr[$v['country']] = 0;
|
|
|
|
$countryArr[$v['country']] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
arsort($countryArr);
|
|
|
|
$top20 = array_slice($countryArr, 0, 15, true);
|
|
|
|
$arr['country'] = $top20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//加上其他询盘
|
|
|
|
ProjectServer::useProject($this->user['project_id']);
|
|
|
|
$arr['total'] += InquiryOther::count();
|
|
|
|
$arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count();
|
|
|
|
$countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime])
|
|
|
|
->select("country",DB::raw('COUNT(*) as count'))
|
|
|
|
->groupBy('country')->get()->toArray();
|
|
|
|
foreach ($countryData as $v1){
|
|
|
|
if(isset($countryArr[$v1['country']])){
|
|
|
|
$countryArr[$v1['country']] += $v1['count'];
|
|
|
|
}else{
|
|
|
|
$countryArr[$v1['country']] = $v1['count'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
arsort($countryArr);
|
|
|
|
$top20 = array_slice($countryArr, 0, 15, true);
|
|
|
|
$arr['country'] = $top20;
|
|
|
|
return $arr;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|