作者 lyh

gx

@@ -149,13 +149,13 @@ class ComController extends BaseController @@ -149,13 +149,13 @@ class ComController extends BaseController
149 public function ceshi(){ 149 public function ceshi(){
150 150
151 $currentDateTime = Carbon::now(); 151 $currentDateTime = Carbon::now();
152 - $startTime = $currentDateTime->subMonth()->startOfMonth()->toDateString(); 152 + $startTime = $currentDateTime->subMonth()->startOfMonth();
153 // 获取上个月的结束时间 153 // 获取上个月的结束时间
154 - $endTime = $currentDateTime->subMonth()->endOfMonth(); 154 + $endTime = $startTime->copy()->subMonth()->endOfMonth();
155 $pv = DB::table('gl_count') 155 $pv = DB::table('gl_count')
156 ->where(['project_id'=>1]) 156 ->where(['project_id'=>1])
157 - ->where('date','>=',$startTime.' 00:00:00')  
158 - ->where('date','<=',$endTime.' 23:59:59') 157 + ->where('date','>=',$startTime->toDateString().' 00:00:00')
  158 + ->where('date','<=',$endTime->toDateString().' 23:59:59')
159 ->sum('pv_num'); 159 ->sum('pv_num');
160 $this->response('success',Code::SUCCESS,$endTime); 160 $this->response('success',Code::SUCCESS,$endTime);
161 } 161 }