diff --git a/application/api/controller/Calendar.php b/application/api/controller/Calendar.php new file mode 100644 index 00000000..e849f3e0 --- /dev/null +++ b/application/api/controller/Calendar.php @@ -0,0 +1,43 @@ +request->post("date"); + if (!$date) { + return $this->_error("日期不能为空"); + } + //查询这个时间的服务 + $service = Db::name('order_exe')->where('date', $date)->where('abnormal', 0)->select(); + $serviceDate = []; + if ($service) { + //查询到有数据,就去找服务人员 + foreach ($service as $v) { + if ($v['staff_id'] != null) { + $staffName = Db::name('staff')->where('id', $v['staff_id']) + ->where('onwork', 1) + ->where('leave', 1) + ->find(); + if ($staffName){ + $startTime = date('H:i', strtotime($v['start_time'])); + $timeoutTime = date('H:i', strtotime($v['timeout'])); + $timeRange = $startTime . '-' . $timeoutTime; + $serviceDate[] = [ + 'date' => $v['date'], + 'staff_name' => $staffName['name'], + 'addtime' => $v['addtime'] == 1 ? '上午' : ($v['addtime'] == 2 ? '下午' : ''), //1表示上午,2表示下午 + 'serviceTime' => $timeRange, + 'xq' => $v['xq'], + ]; + } + } + } + } + return $this->_success("成功", $serviceDate); + } +} \ No newline at end of file