添加日历
This commit is contained in:
43
application/api/controller/Calendar.php
Normal file
43
application/api/controller/Calendar.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
class Calendar extends ApiBase
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$date = $this->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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user