Merge branch 'develop'

This commit is contained in:
mzl
2025-10-12 17:10:14 +08:00
parent 3a7449e2e9
commit 89d633389c
43 changed files with 4173 additions and 364 deletions
@@ -5,6 +5,9 @@ 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;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\VehVehicleSku;
@@ -25,6 +28,13 @@ class VehVehicleSkuService
*/
protected $validator = VehVehicleSkuValidate::class;
protected $logic;
public function __construct()
{
$this->logic = (new VehVehicleSkuLogic());
}
/**
* 获取验证器
*/
@@ -111,6 +121,15 @@ class VehVehicleSkuService
$config['orWhere'][] = [$col, 'like', $k];
}
}
if(isset($p['brand_id']) && $p['brand_id']){
$brand_code = Brand::where('id', $p['brand_id'])->value('brand_code');
$config['where']['brand_code'] = $brand_code;
}
if(isset($p['series_id']) && $p['series_id']){
$series_code = BrandSeries::where('id', $p['series_id'])->value('series_code');
$config['where']['series_code'] = $series_code;
}
break;
case 'show':
$config['where']['id'] = $p['id'];
@@ -138,6 +157,33 @@ class VehVehicleSkuService
if (empty($data['model_name'])) {
$data['model_name'] = ModelNaming::buildModelName($data);
}
if (empty($data['engine_disp_l'])) {
$data['engine_disp_l'] = 0;
}
if (empty($data['engine_turbo'])) {
$data['engine_turbo'] = 0;
}
if (empty($data['engine_power_kw'])) {
$data['engine_power_kw'] = 0;
}
if (empty($data['battery_kwh'])) {
$data['battery_kwh'] = 0;
}
if (empty($data['gears'])) {
$data['gears'] = 1;
}
if (empty($data['range_km'])) { //续航
$data['range_km'] = 0;
}
if (empty($data['doors'])) { //车位数
$data['doors'] = 0;
}
if (empty($data['seats'])) { //座位数
$data['seats'] = 0;
}
if (empty($data['weight_kg'])) { //整车质量
$data['weight_kg'] = 0;
}
$data['sku_code'] = SkuCodeBuilder::build($data);
$data['corp_id'] = 0;
$data['created_by'] = $request->user->uid;
@@ -177,4 +223,12 @@ class VehVehicleSkuService
return $res;
}
/**
* 获取车型list
*/
public function getList($data)
{
return $this->logic->getList($data);
}
}