|
...
|
...
|
@@ -89,7 +89,6 @@ class SxBasement extends Frontend |
|
|
|
if($endTime <= $startTime) {
|
|
|
|
$this->error('结束时间不能小于开始时间');
|
|
|
|
}
|
|
|
|
$start = $startTime - 1;
|
|
|
|
$stationInfo = Station::alias('a')
|
|
|
|
->field('a.id,a.station_name,a.capacity,count(sa.id) as appoint_count')
|
|
|
|
->join('fa_station_appointment sa','a.id = sa.station_id','LEFT')
|
|
...
|
...
|
@@ -106,9 +105,9 @@ class SxBasement extends Frontend |
|
|
|
$this->error("该工位可容纳{$stationInfo['capacity']}人");
|
|
|
|
}
|
|
|
|
$res = Db::table('fa_station_appointment')
|
|
|
|
->whereOr("station_start_time >= {$start} AND station_start_time <= {$endTime}")
|
|
|
|
->whereOr("station_start_time <= {$start} AND station_end_time >= {$endTime}")
|
|
|
|
->whereOr("station_end_time >= {$start} AND station_end_time <= {$endTime}")
|
|
|
|
->whereOr("station_start_time >= {$startTime} AND station_start_time <= {$endTime}")
|
|
|
|
->whereOr("station_start_time <= {$startTime} AND station_end_time >= {$endTime}")
|
|
|
|
->whereOr("station_end_time >= {$startTime} AND station_end_time <= {$endTime}")
|
|
|
|
->having("station_id = {$params['station_id']}")
|
|
|
|
->select();
|
|
|
|
if($res) {
|
|
...
|
...
|
@@ -126,4 +125,26 @@ class SxBasement extends Frontend |
|
|
|
$this->success('预约成功','/index/sx_basement/index');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 工位列表
|
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
|
* @throws \think\exception\DbException
|
|
|
|
*/
|
|
|
|
public function station(){
|
|
|
|
$params = $this->request->post();
|
|
|
|
$startTime = strtotime($params['station_date'].$params['station_start_time']);
|
|
|
|
$endTime = strtotime($params['station_date'].$params['station_end_time']);
|
|
|
|
//工位
|
|
|
|
$stationList = Station::alias('a')
|
|
|
|
->field('a.id,a.station_name,count(sa.id) as appoint_count')
|
|
|
|
->join('fa_station_appointment sa','a.id = sa.station_id','LEFT')
|
|
|
|
->whereOr("station_start_time >= {$startTime} AND station_start_time <= {$endTime}")
|
|
|
|
->whereOr("station_start_time <= {$startTime} AND station_end_time >= {$endTime}")
|
|
|
|
->whereOr("station_end_time >= {$startTime} AND station_end_time <= {$endTime}")
|
|
|
|
->where('a.school_id',$this->auth->school_id)
|
|
|
|
->group('a.id')
|
|
|
|
->select();
|
|
|
|
$this->success('查询成功',$stationList);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|