|
...
|
...
|
@@ -64,8 +64,24 @@ class MonthProjectCount extends Command |
|
|
|
->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month'))
|
|
|
|
->orderBy('month', 'asc')
|
|
|
|
->groupBy('month')->get()->toArray();
|
|
|
|
foreach ($list as $v){
|
|
|
|
$data[] = $v->month;
|
|
|
|
$data = [];
|
|
|
|
if (!empty($list)) {
|
|
|
|
// 提取已有月份
|
|
|
|
foreach ($list as $v) {
|
|
|
|
$data[] = $v->month;
|
|
|
|
}
|
|
|
|
// 生成连续月份
|
|
|
|
$startMonth = $data[0];
|
|
|
|
$endMonth = end($data);
|
|
|
|
$fullMonths = [];
|
|
|
|
$current = $startMonth;
|
|
|
|
while ($current <= $endMonth) {
|
|
|
|
$fullMonths[] = $current;
|
|
|
|
$current = date('Y-m', strtotime($current . ' +1 month'));
|
|
|
|
}
|
|
|
|
$data = $fullMonths;
|
|
|
|
} else {
|
|
|
|
$data = [];
|
|
|
|
}
|
|
|
|
$list = $this->fillMissingMonths($data);
|
|
|
|
foreach ($list as $v){
|
...
|
...
|
|