Merge branch 'feature/sku_crawl' into develop

This commit is contained in:
2025-10-11 10:51:06 +08:00
4 changed files with 40 additions and 0 deletions
@@ -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)
{
+5
View File
@@ -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']);
}
}
@@ -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);
}
}
+1
View File
@@ -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']);
});
});