|
|
|
@ -9,12 +9,14 @@ use App\Models\Parking; |
|
|
|
use App\Models\ParkingChannel; |
|
|
|
use App\Models\ParkingLicensePlate; |
|
|
|
use App\Models\ParkingPattern; |
|
|
|
use App\Models\ParkingPatternSpace; |
|
|
|
use App\Models\ParkingReservation; |
|
|
|
use App\Models\ParkingSpace; |
|
|
|
use App\Models\ParkingSpaceAttributes; |
|
|
|
use App\Models\ParkingSpaceType; |
|
|
|
use App\Services\ApiResponseService; |
|
|
|
use App\Services\ParkingAdminUserService; |
|
|
|
use App\Services\ParkingPatternSpaceService; |
|
|
|
use App\Services\ParkingReservationService; |
|
|
|
use Exception; |
|
|
|
use Illuminate\Http\JsonResponse; |
|
|
|
@ -328,7 +330,7 @@ class ParkingReservationController extends BaseController |
|
|
|
$now_date = date("Y-m-d", time()); |
|
|
|
|
|
|
|
$query = ParkingReservation::query(); |
|
|
|
//$query->where('date', $now_date); |
|
|
|
$query->where('date', $now_date); |
|
|
|
if (isset($param['parking_id'])) { |
|
|
|
$query->where('parking_id', $param['parking_id']); |
|
|
|
} |
|
|
|
@ -339,14 +341,17 @@ class ParkingReservationController extends BaseController |
|
|
|
|
|
|
|
$patternId = EventCalendar::getDatePatternId($date); |
|
|
|
$space_set_name = ''; |
|
|
|
$pattern_space_type_ids = []; |
|
|
|
if ($patternId) { |
|
|
|
$space_set_name = ParkingPattern::getName($patternId); |
|
|
|
$pattern_space_type_ids = ParkingPatternSpace::getParkingSpaceTypeIds($patternId); |
|
|
|
} |
|
|
|
$space_type_ids = $query->pluck('space_type_id')->toArray(); |
|
|
|
$member_type_list = []; |
|
|
|
if ($space_type_ids) { |
|
|
|
if ($pattern_space_type_ids && $space_type_ids) { |
|
|
|
$temp_space_type = array_intersect($pattern_space_type_ids, $space_type_ids); |
|
|
|
$member_type_list = ParkingSpaceType::getData(); |
|
|
|
$counts = array_count_values((array)$space_type_ids); |
|
|
|
$counts = array_count_values($temp_space_type); |
|
|
|
foreach ($member_type_list as &$item) { |
|
|
|
$item['count'] = $counts[$item['id']] ?? 0; |
|
|
|
unset($item['id']); |
|
|
|
|