|
@@ -64,10 +64,13 @@ class MonthReportController extends BaseController |
|
@@ -64,10 +64,13 @@ class MonthReportController extends BaseController |
|
64
|
if(!empty($info['country'])){
|
64
|
if(!empty($info['country'])){
|
|
65
|
$info['country'] = json_decode($info['country']);
|
65
|
$info['country'] = json_decode($info['country']);
|
|
66
|
}
|
66
|
}
|
|
67
|
- // 获取上个月的开始时间
|
|
|
|
68
|
- $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
|
|
|
|
69
|
- // 获取上个月的结束时间
|
|
|
|
70
|
- $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
|
67
|
+ // 创建指定年月的 DateTime 对象
|
|
|
|
68
|
+ $date = $this->map['month'];
|
|
|
|
69
|
+ $start = new DateTime("$date-01 00:00:00");
|
|
|
|
70
|
+ // 克隆 $start 对象并设置到下个月的第一天,减去1秒得到该月的最后一秒
|
|
|
|
71
|
+ $end = (clone $start)->modify('last day of this month')->setTime(23, 59, 59);
|
|
|
|
72
|
+ $startTime = $start->format('Y-m-d H:i:s');
|
|
|
|
73
|
+ $endTime = $end->format('Y-m-d H:i:s');
|
|
71
|
$param = [
|
74
|
$param = [
|
|
72
|
'date' => ['between',[$startTime,$endTime]],
|
75
|
'date' => ['between',[$startTime,$endTime]],
|
|
73
|
'project_id' => $this->user['project_id']
|
76
|
'project_id' => $this->user['project_id']
|