正在显示
1 个修改的文件
包含
19 行增加
和
19 行删除
| @@ -62,28 +62,28 @@ class MonthCountLogic extends BaseLogic | @@ -62,28 +62,28 @@ class MonthCountLogic extends BaseLogic | ||
| 62 | * @time :2023/6/30 14:29 | 62 | * @time :2023/6/30 14:29 |
| 63 | */ | 63 | */ |
| 64 | public function inquiryCount(&$arr,&$startTime,&$endTime,$domain){ | 64 | public function inquiryCount(&$arr,&$startTime,&$endTime,$domain){ |
| 65 | - //TODO::上线后注释 | ||
| 66 | -// $domain = 'https://demomark.globalso.com/'; | ||
| 67 | $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); | 65 | $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); |
| 68 | - //总数 | ||
| 69 | - $arr['total'] = $inquiry_list['data']['total'] ?? 0; | ||
| 70 | - //数据详情 | ||
| 71 | - $data = $inquiry_list['data']['data']; | ||
| 72 | - $arr['month_total'] = 0; | ||
| 73 | - $countryArr = []; | ||
| 74 | - foreach ($data as $v){ | ||
| 75 | - if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){ | ||
| 76 | - $arr['month_total']++; | ||
| 77 | - } | ||
| 78 | - if(isset($countryArr[$v['country']])){ | ||
| 79 | - $countryArr[$v['country']]++; | ||
| 80 | - }else{ | ||
| 81 | - $countryArr[$v['country']] = 0; | 66 | + if(!empty($inquiry_list)){ |
| 67 | + //总数 | ||
| 68 | + $arr['total'] = $inquiry_list['data']['total'] ?? 0; | ||
| 69 | + //数据详情 | ||
| 70 | + $data = $inquiry_list['data']['data']; | ||
| 71 | + $arr['month_total'] = 0; | ||
| 72 | + $countryArr = []; | ||
| 73 | + foreach ($data as $v){ | ||
| 74 | + if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){ | ||
| 75 | + $arr['month_total']++; | ||
| 76 | + } | ||
| 77 | + if(isset($countryArr[$v['country']])){ | ||
| 78 | + $countryArr[$v['country']]++; | ||
| 79 | + }else{ | ||
| 80 | + $countryArr[$v['country']] = 0; | ||
| 81 | + } | ||
| 82 | } | 82 | } |
| 83 | + arsort($countryArr); | ||
| 84 | + $top20 = array_slice($countryArr, 0, 15, true); | ||
| 85 | + $arr['country'] = $top20; | ||
| 83 | } | 86 | } |
| 84 | - arsort($countryArr); | ||
| 85 | - $top20 = array_slice($countryArr, 0, 15, true); | ||
| 86 | - $arr['country'] = $top20; | ||
| 87 | return $arr; | 87 | return $arr; |
| 88 | } | 88 | } |
| 89 | 89 |
-
请 注册 或 登录 后发表评论