find($id); if (!$photo) { throw new ApiException(40401, '照片不存在', 404); } if ($scope === 'enterprise') { $this->access->enterpriseTask($resource, (int) $photo->delivery_id); } elseif ($scope === 'driver') { $this->access->driverTask($resource, (int) $photo->delivery_id); } else { throw new ApiException(42201, '照片访问身份无效', 422); } return $photo; } }