Browse Source

添加维修车位优化2

master
wanghongjun 3 weeks ago
parent
commit
993b22a024
  1. 6
      app/Services/ParkingSpaceRepairService.php

6
app/Services/ParkingSpaceRepairService.php

@ -61,12 +61,14 @@ class ParkingSpaceRepairService extends BaseService
try {
DB::beginTransaction();
$spaceNameArr = explode(',', $data['parking_space_name']);
$count = count($spaceNameArr);
foreach ($spaceNameArr as $parking_space_name) {
$space = ParkingSpace::query()->where('number', $parking_space_name)->first();
$str = $count > 1 ? ':' . $parking_space_name : '';
if (!$space) {
throw new CustomException(
__service($this->menuTitle . '.space_not_exists')
. ':' . $parking_space_name
. $str
);
}
// 维修状态不可添加
@ -75,7 +77,7 @@ class ParkingSpaceRepairService extends BaseService
if ($space['status'] == 2) {
throw new CustomException(
__service($this->menuTitle . '.space_exists')
. ':' . $parking_space_name
. $str
);
}
$model = $this->createData(

Loading…
Cancel
Save