Browse Source

添加维修车位优化

master
wanghongjun 3 weeks ago
parent
commit
e3a9429395
  1. 13
      app/Services/ParkingSpaceRepairService.php
  2. 3
      app/Services/ParkingSpaceService.php
  3. 3
      resources/lang/en/service.php
  4. 3
      resources/lang/zh-CN/service.php
  5. 3
      resources/lang/zh-TW/service.php

13
app/Services/ParkingSpaceRepairService.php

@ -62,13 +62,22 @@ class ParkingSpaceRepairService extends BaseService
DB::beginTransaction(); DB::beginTransaction();
$spaceNameArr = explode(',', $data['parking_space_name']); $spaceNameArr = explode(',', $data['parking_space_name']);
foreach ($spaceNameArr as $parking_space_name) { foreach ($spaceNameArr as $parking_space_name) {
$space_id = ParkingSpace::getValueId($parking_space_name); $space = ParkingSpace::query()->where('number', $parking_space_name)->first();
if (!$space_id) { if (!$space) {
throw new CustomException( throw new CustomException(
__service($this->menuTitle . '.space_not_exists') __service($this->menuTitle . '.space_not_exists')
. ':' . $parking_space_name . ':' . $parking_space_name
); );
} }
// 维修状态不可添加
$space = $space->toArray();
$space_id = $space['id'];
if ($space['status'] == 2) {
throw new CustomException(
__service($this->menuTitle . '.space_exists')
. ':' . $parking_space_name
);
}
$model = $this->createData( $model = $this->createData(
$space_id, $space_id,
$data['admin_user_id'], $data['admin_user_id'],

3
app/Services/ParkingSpaceService.php

@ -358,6 +358,9 @@ class ParkingSpaceService extends BaseService
} }
if ($status == 2) { if ($status == 2) {
// 维修 // 维修
if ($oldValues['status'] == 2) {
throw new CustomException(__validation('parking_repair_list.space_exists'));
}
$now_times = time(); $now_times = time();
$start_times = strtotime($start_at);// 维修开始时间 $start_times = strtotime($start_at);// 维修开始时间
$end_times = strtotime($end_at);// 维修结束时间 $end_times = strtotime($end_at);// 维修结束时间

3
resources/lang/en/service.php

@ -172,7 +172,8 @@ return [
'not_synced' => 'Not synced', 'not_synced' => 'Not synced',
'synced' => 'Synchronized', 'synced' => 'Synchronized',
'space_not_exists' => 'The parking number does not exist', 'space_not_exists' => 'The parking number does not exist',
'not_send' => 'There is currently no information available for sending maintenance parking space information.' 'not_send' => 'There is currently no information available for sending maintenance parking space information.',
'space_exists' => 'Parking space under repair'
], ],
'gate_control' => [ 'gate_control' => [
'automatic' => 'Automatic entry', 'automatic' => 'Automatic entry',

3
resources/lang/zh-CN/service.php

@ -172,7 +172,8 @@ return [
'not_synced' => '未同步', 'not_synced' => '未同步',
'synced' => '已同步', 'synced' => '已同步',
'space_not_exists' => '车位号不存在', 'space_not_exists' => '车位号不存在',
'not_send' => '目前暂无可发送的维修车位信息' 'not_send' => '目前暂无可发送的维修车位信息',
'space_exists' => '车位维修中'
], ],
'gate_control' => [ 'gate_control' => [
'automatic' => '自动入场', 'automatic' => '自动入场',

3
resources/lang/zh-TW/service.php

@ -172,7 +172,8 @@ return [
'not_synced' => '未同步', 'not_synced' => '未同步',
'synced' => '已同步', 'synced' => '已同步',
'space_not_exists' => '車位號不存在', 'space_not_exists' => '車位號不存在',
'not_send' => '目前暫無可發送的維修車位信息' 'not_send' => '目前暫無可發送的維修車位信息',
'space_exists' => '車位維修中'
], ],
'gate_control' => [ 'gate_control' => [
'automatic' => '自動入場', 'automatic' => '自動入場',

Loading…
Cancel
Save