diff --git a/app/controller/VehicleController.php b/app/controller/VehicleController.php index 5fdedd2..c64f1e7 100644 --- a/app/controller/VehicleController.php +++ b/app/controller/VehicleController.php @@ -3,6 +3,7 @@ namespace app\controller; use app\model\Vehicle; +use app\service\OssService; use plugin\admin\app\model\Location; use util\Util; use support\Request; @@ -40,6 +41,12 @@ class VehicleController // $vehicle->final_location_name = $final_location ? $final_location->name : ''; $fbo_location = Location::find($vehicle->fbo_locations_id); $vehicle->fbo_destination = $fbo_location ? $fbo_location->name : ''; + + if(!str_starts_with($vehicle->url, 'http')){ + $ossservice = new OssService(); + $img_url = $ossservice->generatePrivateUrl($vehicle->img_url,86400); + $vehicle->img_url = $img_url; + } }); $result = ['list' => $vehicles,'count'=>count($vehicles)]; return Util::success($result); diff --git a/plugin/admin/app/controller/VehicleController.php b/plugin/admin/app/controller/VehicleController.php index a6a67a2..b15bd35 100644 --- a/plugin/admin/app/controller/VehicleController.php +++ b/plugin/admin/app/controller/VehicleController.php @@ -2,6 +2,7 @@ namespace plugin\admin\app\controller; +use app\service\OssService; use plugin\admin\app\model\Location; use support\Request; use support\Response; @@ -127,6 +128,13 @@ class VehicleController extends Crud $fbo_location = Location::find($item->fbo_locations_id); $item->fbo_location_name = $fbo_location ? $fbo_location->name : ''; } + + + if(!str_starts_with($items->url, 'http')){ + $ossservice = new OssService(); + $img_url = $ossservice->generatePrivateUrl($item->img_url,86400); + $item->img_url = $img_url; + } return $items; } }