正在显示
1 个修改的文件
包含
10 行增加
和
4 行删除
| @@ -85,18 +85,18 @@ class MonthProjectCount extends Command | @@ -85,18 +85,18 @@ class MonthProjectCount extends Command | ||
| 85 | $arr['total'] = $arr['month_total'] = 0; | 85 | $arr['total'] = $arr['month_total'] = 0; |
| 86 | if(isset($res['data']['count'])){ | 86 | if(isset($res['data']['count'])){ |
| 87 | echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; | 87 | echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; |
| 88 | - $arr['month_total'] = $res['data']['count']; | 88 | + $arr['month_total'] = $res['data']['count'] + InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']); |
| 89 | //获取上一个的count | 89 | //获取上一个的count |
| 90 | $previousMonth = date('Y-m', strtotime($v . ' -1 month')); | 90 | $previousMonth = date('Y-m', strtotime($v . ' -1 month')); |
| 91 | $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]); | 91 | $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]); |
| 92 | if($previousInfo === false){ | 92 | if($previousInfo === false){ |
| 93 | $arr['total'] = $arr['month_total']; | 93 | $arr['total'] = $arr['month_total']; |
| 94 | }else{ | 94 | }else{ |
| 95 | - $arr['total'] = $res['data']['count'] + ($previousInfo['total'] ?? 0); | 95 | + $arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0); |
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| 98 | //获取当月的其他询盘 | 98 | //获取当月的其他询盘 |
| 99 | - $arr['total'] += InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']); | 99 | +// $arr['total'] += InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']); |
| 100 | echo date('Y-m-d H:i:s') . '加上其他询盘:'.$arr['total'] . PHP_EOL; | 100 | echo date('Y-m-d H:i:s') . '加上其他询盘:'.$arr['total'] . PHP_EOL; |
| 101 | $country = []; | 101 | $country = []; |
| 102 | if(isset($res['data']['data'])){ | 102 | if(isset($res['data']['data'])){ |
| @@ -199,7 +199,13 @@ class MonthProjectCount extends Command | @@ -199,7 +199,13 @@ class MonthProjectCount extends Command | ||
| 199 | return $res; | 199 | return $res; |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | - | 202 | + /** |
| 203 | + * @remark :补齐月份 | ||
| 204 | + * @name :fillMissingMonths | ||
| 205 | + * @author :lyh | ||
| 206 | + * @method :post | ||
| 207 | + * @time :2024/8/14 11:11 | ||
| 208 | + */ | ||
| 203 | public function fillMissingMonths($dates) { | 209 | public function fillMissingMonths($dates) { |
| 204 | // 将字符串日期转换为 Carbon 对象 | 210 | // 将字符串日期转换为 Carbon 对象 |
| 205 | $carbonDates = array_map(function($date) { | 211 | $carbonDates = array_map(function($date) { |
-
请 注册 或 登录 后发表评论