From c33c57f3caa15111a75ba22eb7b6cabcccf36450 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Sat, 11 Oct 2025 10:50:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E5=9E=8B=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/VehVehicleSkuController.php | 18 ++++++++++++++++++ app/common/logic/VehVehicleSkuLogic.php | 5 +++++ app/common/service/VehVehicleSkuService.php | 16 ++++++++++++++++ config/route.php | 1 + 4 files changed, 40 insertions(+) diff --git a/app/common/controller/VehVehicleSkuController.php b/app/common/controller/VehVehicleSkuController.php index 3272f28..a3661da 100644 --- a/app/common/controller/VehVehicleSkuController.php +++ b/app/common/controller/VehVehicleSkuController.php @@ -2,6 +2,8 @@ namespace app\common\controller; use app\common\controller\BaseController; +use app\common\model\BrandSeries; +use app\common\service\VehModificationService; use app\common\traits\crud\CrudControllerTrait; use app\common\service\VehVehicleSkuService; use support\exception\BusinessException; @@ -89,6 +91,22 @@ class VehVehicleSkuController extends BaseController } } + public function preset(Request $request){ + + + try { + $series_id = $request->input('series_id'); + $series_code = BrandSeries::where('id', $series_id)->value('series_code'); + $data = [ + 'series_code' => $series_code, + ]; + $result = $this->service->getList($data); + return $this->success($result, '获取车型列表'); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } + public function fields_desc(Request $request) { diff --git a/app/common/logic/VehVehicleSkuLogic.php b/app/common/logic/VehVehicleSkuLogic.php index 505efde..054204a 100644 --- a/app/common/logic/VehVehicleSkuLogic.php +++ b/app/common/logic/VehVehicleSkuLogic.php @@ -52,4 +52,9 @@ class VehVehicleSkuLogic $plain = implode('|', $parts); return hash('sha256', $plain); } + + public function getList($data) + { + return VehVehicleSku::where($data)->orderBy('id','desc')->get(['id', 'sku_code', 'brand_code', 'brand_code', 'series_code', 'series_name', 'model_code', 'model_name', 'msrp']); + } } \ No newline at end of file diff --git a/app/common/service/VehVehicleSkuService.php b/app/common/service/VehVehicleSkuService.php index d8c6e4a..4e54818 100644 --- a/app/common/service/VehVehicleSkuService.php +++ b/app/common/service/VehVehicleSkuService.php @@ -5,6 +5,7 @@ namespace app\common\service; use app\common\logic\Fingerprint; use app\common\logic\ModelNaming; use app\common\logic\SkuCodeBuilder; +use app\common\logic\VehVehicleSkuLogic; use app\common\model\Brand; use app\common\model\BrandSeries; use app\common\validate\VehVehicleSkuValidate; @@ -27,6 +28,13 @@ class VehVehicleSkuService */ protected $validator = VehVehicleSkuValidate::class; + protected $logic; + + public function __construct() + { + $this->logic = (new VehVehicleSkuLogic()); + } + /** * 获取验证器 */ @@ -188,4 +196,12 @@ class VehVehicleSkuService return $res; } + + /** + * 获取车型list + */ + public function getList($data) + { + return $this->logic->getList($data); + } } \ No newline at end of file diff --git a/config/route.php b/config/route.php index 9ce0ee9..18bc3b4 100644 --- a/config/route.php +++ b/config/route.php @@ -499,6 +499,7 @@ Route::group('/crm', function () { Route::any('/store', [app\common\controller\VehVehicleSkuController::class, 'store']); Route::any('/update', [app\common\controller\VehVehicleSkuController::class, 'update']); Route::any('/destroy', [app\common\controller\VehVehicleSkuController::class, 'destroy']); + Route::any('/preset', [app\common\controller\VehVehicleSkuController::class, 'preset']); }); });