|
|
@ -10,6 +10,7 @@ use App\Models\ParkingSpace; |
|
|
use App\Models\ParkingSpaceAttributes; |
|
|
use App\Models\ParkingSpaceAttributes; |
|
|
use App\Models\ParkingSpaceCamera; |
|
|
use App\Models\ParkingSpaceCamera; |
|
|
use App\Models\ParkingSpaceType; |
|
|
use App\Models\ParkingSpaceType; |
|
|
|
|
|
use Illuminate\Support\Facades\Redis; |
|
|
use Illuminate\Support\Facades\Storage; |
|
|
use Illuminate\Support\Facades\Storage; |
|
|
use Illuminate\Support\Str; |
|
|
use Illuminate\Support\Str; |
|
|
|
|
|
|
|
|
@ -47,6 +48,14 @@ class ParkingAccessRecordService extends BaseService |
|
|
// 离开车位 |
|
|
// 离开车位 |
|
|
public function leaveData($id, $data) |
|
|
public function leaveData($id, $data) |
|
|
{ |
|
|
{ |
|
|
|
|
|
$key = 'leave:'. $id . ':data'; |
|
|
|
|
|
$count = Redis::get($key); |
|
|
|
|
|
if (!$count) { |
|
|
|
|
|
Redis::set($key, 1); |
|
|
|
|
|
return false; |
|
|
|
|
|
} else { |
|
|
|
|
|
Redis::del($key); |
|
|
|
|
|
} |
|
|
$model = ParkingAccessRecord::query()->findOrFail($id); |
|
|
$model = ParkingAccessRecord::query()->findOrFail($id); |
|
|
$oldValues = $model->toArray(); |
|
|
$oldValues = $model->toArray(); |
|
|
$data = [ |
|
|
$data = [ |
|
|
@ -60,6 +69,7 @@ class ParkingAccessRecordService extends BaseService |
|
|
$oldValues, |
|
|
$oldValues, |
|
|
$this->menuTitle . '.update' |
|
|
$this->menuTitle . '.update' |
|
|
); |
|
|
); |
|
|
|
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 车辆进入车位 |
|
|
// 车辆进入车位 |
|
|
@ -119,7 +129,10 @@ class ParkingAccessRecordService extends BaseService |
|
|
$data['leave_time'] = strtotime($now_time); |
|
|
$data['leave_time'] = strtotime($now_time); |
|
|
// 有记录 无车牌 离场 |
|
|
// 有记录 无车牌 离场 |
|
|
if (!isset($data['license_plate_id'])) { |
|
|
if (!isset($data['license_plate_id'])) { |
|
|
$this->leaveData($id, $data); |
|
|
$leaveRes = $this->leaveData($id, $data); |
|
|
|
|
|
if (!$leaveRes) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
// 同步车位车辆进入 |
|
|
// 同步车位车辆进入 |
|
|
$ParkingSpaceService->updateEnterLeave($space_id, 0, $now_time); |
|
|
$ParkingSpaceService->updateEnterLeave($space_id, 0, $now_time); |
|
|
// VIP车辆离场 |
|
|
// VIP车辆离场 |
|
|
@ -137,7 +150,10 @@ class ParkingAccessRecordService extends BaseService |
|
|
// 有记录 车牌不同 |
|
|
// 有记录 车牌不同 |
|
|
if ($old_license_plate_id) { |
|
|
if ($old_license_plate_id) { |
|
|
// 原车牌离场 |
|
|
// 原车牌离场 |
|
|
$this->leaveData($id, $data); |
|
|
$leaveRes = $this->leaveData($id, $data); |
|
|
|
|
|
if (!$leaveRes) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
// VIP车辆离场 |
|
|
// VIP车辆离场 |
|
|
ParkingVipListService::leave($id, $now_time); |
|
|
ParkingVipListService::leave($id, $now_time); |
|
|
} |
|
|
} |
|
|
|