diff --git a/application/api/model/Room.php b/application/api/model/Room.php index 22b35aee..fb17f315 100644 --- a/application/api/model/Room.php +++ b/application/api/model/Room.php @@ -305,21 +305,21 @@ class Room extends Model ->where(function($query) use ($currentTime) { // 全天营业的房间(start_time和end_time都为00:00:00) $query->where(function($q) { - $q->where('start_time', '00:00:00') - ->where('end_time', '00:00:00'); + $q->where('a.start_time', '00:00:00') + ->where('a.end_time', '00:00:00'); })->whereOr(function($q) use ($currentTime) { // 正常时间限制的房间 $q->where(function($q2) use ($currentTime) { - $q2->where('start_time', '<=', $currentTime) - ->where('end_time', '>=', $currentTime) - ->where('start_time', '<=', 'end_time') - ->where('start_time', '<>', '00:00:00'); // 排除全天营业 + $q2->where('a.start_time', '<=', $currentTime) + ->where('a.end_time', '>=', $currentTime) + ->where('a.start_time', '<=', 'end_time') + ->where('a.start_time', '<>', '00:00:00'); // 排除全天营业 })->whereOr(function($q2) use ($currentTime) { // 跨天营业 - $q2->where('start_time', '>', 'end_time') + $q2->where('a.start_time', '>', 'a.end_time') ->where(function($q3) use ($currentTime) { - $q3->where('start_time', '<=', $currentTime) - ->whereOr('end_time', '>=', $currentTime); + $q3->where('a.start_time', '<=', $currentTime) + ->whereOr('a.end_time', '>=', $currentTime); }); }); });