数据多语言

This commit is contained in:
2025-05-07 14:19:47 +08:00
parent 4c66404a6c
commit 3eea6db29d
19 changed files with 1989 additions and 825 deletions
@@ -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();
+1 -1
View File
@@ -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">
+3 -3
View File
@@ -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">