作者 lyh

gxdemo脚本

@@ -90,6 +90,7 @@ class MonthProjectCount extends Command @@ -90,6 +90,7 @@ class MonthProjectCount extends Command
90 } 90 }
91 //获取当月的其他询盘 91 //获取当月的其他询盘
92 $arr['total'] += InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']); 92 $arr['total'] += InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']);
  93 + echo date('Y-m-d H:i:s') . '加上其他询盘:'.$arr['total'] . PHP_EOL;
93 $country = []; 94 $country = [];
94 if(isset($res['data']['data'])){ 95 if(isset($res['data']['data'])){
95 $country = $res['data']['data']; 96 $country = $res['data']['data'];
@@ -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']