前端分页,后端标签关闭修复
This commit is contained in:
@@ -14,6 +14,7 @@ use app\model\LocationAr;
|
||||
|
||||
use app\service\OssService;
|
||||
// use plugin\admin\app\model\Location;
|
||||
use app\service\TranslatorService;
|
||||
use util\Util;
|
||||
use support\Request;
|
||||
use support\Cache;
|
||||
@@ -40,25 +41,28 @@ class VehicleController
|
||||
{
|
||||
|
||||
$lang = $request->post('lang', 'zh');
|
||||
// 接收请求参数(Webman自动注入)
|
||||
$page = $request->post('page', 1); // 默认第1页
|
||||
$pageSize = $request->post('pageSize', 30); // 默认每页30条
|
||||
|
||||
switch ($lang) {
|
||||
case 'zh':
|
||||
$vehicles = Vehicle::with('location')->with('finalLocation')->get();
|
||||
$vehicles = Vehicle::with('location')->with('finalLocation') ->offset(($page-1)*$pageSize) ->limit($pageSize)->get();
|
||||
$hz = new Location();
|
||||
break;
|
||||
|
||||
case 'en':
|
||||
$vehicles = VehicleEn::with('location')->with('finalLocation')->get();
|
||||
$vehicles = VehicleEn::with('location')->with('finalLocation')->offset(($page-1)*$pageSize) ->limit($pageSize)->get();
|
||||
$hz = new LocationEn();
|
||||
break;
|
||||
|
||||
case 'ru':
|
||||
$vehicles = VehicleRu::with('location')->with('finalLocation')->get();
|
||||
$vehicles = VehicleRu::with('location')->with('finalLocation')->offset(($page-1)*$pageSize) ->limit($pageSize)->get();
|
||||
$hz = new LocationRu();
|
||||
break;
|
||||
|
||||
case 'ar':
|
||||
$vehicles = VehicleAr::with('location')->with('finalLocation')->get();
|
||||
$vehicles = VehicleAr::with('location')->with('finalLocation')->offset(($page-1)*$pageSize) ->limit($pageSize)->get();
|
||||
$hz = new LocationAr();
|
||||
break;
|
||||
}
|
||||
@@ -116,8 +120,8 @@ class VehicleController
|
||||
}
|
||||
unset($vehicle);
|
||||
// =================================== new ===================================== end
|
||||
|
||||
$result = ['list' => $vehicles,'count'=>count($vehicles)];
|
||||
$count = Vehicle::count();
|
||||
$result = ['list' => $vehicles,'count'=>$count];
|
||||
return Util::success($result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user