优化
This commit is contained in:
@@ -62,7 +62,7 @@ class VehicleController extends Crud
|
||||
public function status()
|
||||
{
|
||||
$lang = session('lang', 'zh-cn');
|
||||
$status = $this->status[$lang];
|
||||
$status = isset($this->status[$lang])?$this->status[$lang]:$this->status['zh-cn'];
|
||||
return json(['code' => 0, 'msg' => 'success', 'data' => $status]);
|
||||
}
|
||||
|
||||
@@ -530,6 +530,7 @@ class VehicleController extends Crud
|
||||
break;
|
||||
}
|
||||
|
||||
$ossservice = new OssService();
|
||||
foreach ($items as &$item) {
|
||||
$item = $vehicle::find($item['id']);
|
||||
$location = $hz::find($item->locations_id);
|
||||
@@ -551,29 +552,26 @@ class VehicleController extends Crud
|
||||
$location = $hz::find($item->fbo_locations_id);
|
||||
$item->fbo_location_name = $location ? $location->name : '';
|
||||
|
||||
if(!str_starts_with($item['img_url'], 'http')){
|
||||
try {
|
||||
$img_url = Cache::get('img_dibai_'.$item->id);
|
||||
if ($img_url) {
|
||||
$item['img_url'] = $img_url;
|
||||
} else {
|
||||
$ossservice = new OssService();
|
||||
$img_url = $ossservice->generatePrivateUrl($item['img_url'],86400);
|
||||
$item['img_url'] = $img_url;
|
||||
Cache::set('img_dibai_'.$item->id, $img_url, 86390);
|
||||
}
|
||||
|
||||
try {
|
||||
$img_url = Cache::get('img_dibai_'.$item->id);
|
||||
if ($img_url) {
|
||||
$item['img_url'] = $img_url;
|
||||
} else {
|
||||
$img_url = $ossservice->generatePrivateUrl($item['img_url'],86400);
|
||||
$item['img_url'] = $img_url;
|
||||
Cache::set('img_dibai_'.$item->id, $img_url, 86390);
|
||||
}
|
||||
|
||||
// $ossservice = new OssService();
|
||||
// $oss_picture = $ossservice->generatePrivateUrl($follow['picture'],86400);
|
||||
// $item['img_url'] = $img_url;
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Vehicle image URL generation failed:", [
|
||||
'error' => $e->getMessage(),
|
||||
'original_url' => $item['img_url'],
|
||||
'error_code' => $e->getCode(),
|
||||
'trace' => $e->getTraceAsString()
|
||||
]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Vehicle image URL generation failed:", [
|
||||
'error' => $e->getMessage(),
|
||||
'original_url' => $item['img_url'],
|
||||
'error_code' => $e->getCode(),
|
||||
'trace' => $e->getTraceAsString()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,14 +98,23 @@
|
||||
// 表头参数
|
||||
let cols = [[
|
||||
{type: "checkbox", align: "center"},
|
||||
{title: translations.id, align: "center", field: "id"},
|
||||
{title: translations.vin, align: "center", field: "vin"},
|
||||
{title: translations.brand, align: "center", field: "brand"},
|
||||
// {title: translations.img_url, align: "center", field: "img_url"},
|
||||
{
|
||||
title: "translations.img_url",
|
||||
field: "url",
|
||||
templet: function (d) {
|
||||
return '<img src="' + encodeURI(d['url']) + '" style="max-width:32px;max-height:32px;" />';
|
||||
}
|
||||
},
|
||||
{title: translations.status, align: "center", field: "status_txt"},
|
||||
{title: translations.status, align: "center", field: "status_txt"},
|
||||
{title: translations.current_location, align: "center", field: "location_name"},
|
||||
{title: translations.final_location, align: "center", field: "final_location_name"},
|
||||
{title: translations.fbo_location, align: "center", field: "fbo_location_name"},
|
||||
{title: translations.created_at, align: "center", field: "created_at"},
|
||||
{title: translations.updated_at, align: "center", field: "updated_at"},
|
||||
// {title: translations.final_location, align: "center", field: "final_location_name"},
|
||||
// {title: translations.fbo_location, align: "center", field: "fbo_location_name"},
|
||||
// {title: translations.created_at, align: "center", field: "created_at"},
|
||||
// {title: translations.updated_at, align: "center", field: "updated_at"},
|
||||
{title: translations.operation, toolbar: "#table-bar", align: "center", fixed: "right", width: 150}
|
||||
]];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user