数据多语言
This commit is contained in:
@@ -3,6 +3,12 @@ declare (strict_types = 1);
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use app\model\LocationAr;
|
||||
use app\model\LocationEn;
|
||||
use app\model\LocationRu;
|
||||
use app\model\VehicleAr;
|
||||
use app\model\VehicleEn;
|
||||
use app\model\VehicleRu;
|
||||
use app\service\OssService;
|
||||
use plugin\admin\app\model\Location;
|
||||
use support\Log;
|
||||
@@ -97,6 +103,8 @@ class VehicleController extends Crud
|
||||
|
||||
// 合并翻译,确保语言文件中的翻译优先
|
||||
$translations = array_merge($required_translations, $translations);
|
||||
|
||||
|
||||
|
||||
return view('vehicle/index', [
|
||||
'lang' => $lang,
|
||||
@@ -285,13 +293,44 @@ class VehicleController extends Crud
|
||||
foreach ($items as &$item) {
|
||||
$location = Location::find($item->locations_id);
|
||||
// $item->status = $this->status[$item->status]??$this->status[0];
|
||||
$item->status = "已到达迪拜仓库";
|
||||
// $item->status = "已到达迪拜仓库";
|
||||
$item->location_name = $location ? $location->name : '';
|
||||
$final_location = Location::find($item->final_locations_id);
|
||||
$item->final_location_name = $final_location ? $final_location->name : '';
|
||||
$fbo_location = Location::find($item->fbo_locations_id);
|
||||
$item->fbo_location_name = $fbo_location ? $fbo_location->name : '';
|
||||
|
||||
$lang = session('lang', 'zh-cn');
|
||||
switch ($lang) {
|
||||
case 'zh-cn':
|
||||
$vehicle = new \app\model\Vehicle();
|
||||
$hz = new \app\model\Location();
|
||||
break;
|
||||
|
||||
case 'en':
|
||||
$vehicle = new \app\model\VehicleEn();
|
||||
$hz = new \app\model\LocationEn();
|
||||
break;
|
||||
|
||||
case 'ru':
|
||||
$vehicle = new \app\model\VehicleRu();
|
||||
$hz = new \app\model\LocationRu();
|
||||
break;
|
||||
case 'ar':
|
||||
$vehicle = new \app\model\VehicleAr();
|
||||
$hz = new \app\model\LocationAr();
|
||||
break;
|
||||
}
|
||||
|
||||
$location = $hz::find($item->locations_id);
|
||||
$item->location_name = $location ? $location->name : '';
|
||||
$car = $vehicle::find($item->id);
|
||||
$item->status = $car ? $car->status : $item->status;
|
||||
$location = $hz::find($item->final_location_id);
|
||||
$item->final_location_name = $location ? $location->name : '';
|
||||
$location = $hz::find($item->fbo_locations_id);
|
||||
$item->fbo_location_name = $location ? $location->name : '';
|
||||
|
||||
if(!str_starts_with($item['img_url'], 'http')){
|
||||
try {
|
||||
$ossservice = new OssService();
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<!-- 图 标 -->
|
||||
<img class="logo">
|
||||
<!-- 标 题 -->
|
||||
<a href="https://dashboard.hesultd.com/"><span class="title"><?= $translations['system_name'] ?? 'Vehicle Data Platform' ?></span></a>
|
||||
<a href="http://dashboard.hesuu.com:25506/"><span class="title"><?= $translations['system_name'] ?? 'Vehicle Data Platform' ?></span></a>
|
||||
</div>
|
||||
<!-- 菜 单 内 容 -->
|
||||
<div class="layui-side-scroll">
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
|
||||
<script>
|
||||
// 页面加载时自动跳转
|
||||
window.onload = function() {
|
||||
window.location.href = 'https://dashboard-server.hesultd.com/app/admin';
|
||||
}
|
||||
// window.onload = function() {
|
||||
// window.location.href = 'https://dashboard-server.hesultd.com/app/admin';
|
||||
// }
|
||||
</script>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
|
||||
Reference in New Issue
Block a user