品牌名
This commit is contained in:
@@ -49,11 +49,11 @@ class VehicleNewService extends BaseService
|
||||
'album.translation' => ['id', 'album_id', 'locale', 'alt'],
|
||||
'content' => ['id', 'vehicle_id', 'status', 'sort'],
|
||||
'content.translation' => ['id', 'content_id', 'locale', 'content'],
|
||||
'brand.translation' => ['brand_id', 'name'],
|
||||
'types.translation' => ['type_id', 'name'],
|
||||
'energy.translation' => ['energy_id', 'name'],
|
||||
'models.translation' => ['model_id', 'name'],
|
||||
],
|
||||
'brand.translation' => ['brand_id', 'name'],
|
||||
'types.translation' => ['type_id', 'name'],
|
||||
'energy.translation' => ['energy_id', 'name'],
|
||||
'models.translation' => ['model_id', 'name'],
|
||||
'sorts' => [
|
||||
['field' => 'id', 'direction' => 'desc']
|
||||
],
|
||||
@@ -266,22 +266,22 @@ class VehicleNewService extends BaseService
|
||||
$sourceFields
|
||||
);
|
||||
|
||||
$askedsId = [];
|
||||
foreach ($askeds as $asked) {
|
||||
$askedsourceFields = $VehicleNewAskedService->extractSourceFields($asked);
|
||||
$asked['vehicle_id'] = $id;
|
||||
$askedsId = [];
|
||||
if(!empty($asked['id'])){
|
||||
$askedId = $asked['id'];
|
||||
$askedsId[] = $askedId;
|
||||
$asked_res = $VehicleNewAskedService->update($askedId, $asked);
|
||||
if (!$asked_res) {
|
||||
throw new BusinessException('提交失败:常见问题');
|
||||
throw new BusinessException('提交失败:常见问题2');
|
||||
}
|
||||
} else {
|
||||
unset($asked['id']);
|
||||
$asked_res = $VehicleNewAskedService->create($asked);
|
||||
if (!$asked_res) {
|
||||
throw new BusinessException('提交失败:常见问题');
|
||||
throw new BusinessException('提交失败:常见问题1');
|
||||
}
|
||||
$askedId = $asked_res->id;
|
||||
$askedsId[] = $askedId;
|
||||
@@ -295,10 +295,10 @@ class VehicleNewService extends BaseService
|
||||
}
|
||||
VehicleNewAskedModel::whereNotIn('id', $askedsId)->where('vehicle_id',$id)->delete();
|
||||
|
||||
$traitsId = [];
|
||||
foreach ($traits as $trait) {
|
||||
$traitsourceFields = $VehicleNewTraitService->extractSourceFields($trait);
|
||||
$trait['vehicle_id'] = $id;
|
||||
$traitsId = [];
|
||||
if(!empty($trait['id'])){
|
||||
$traitId = $trait['id'];
|
||||
$traitsId[] = $traitId;
|
||||
@@ -324,6 +324,7 @@ class VehicleNewService extends BaseService
|
||||
}
|
||||
VehicleNewTraitModel::whereNotIn('id', $traitsId)->where('vehicle_id',$id)->delete();
|
||||
|
||||
$albumsId = [];
|
||||
foreach ($albums as $album) {
|
||||
$albumsourceFields = $VehicleNewAlbumService->extractSourceFields($album);
|
||||
$album['vehicle_id'] = $id;
|
||||
@@ -333,7 +334,6 @@ class VehicleNewService extends BaseService
|
||||
// throw new BusinessException('提交失败');
|
||||
// }
|
||||
|
||||
$albumsId = [];
|
||||
if(!empty($album['id'])){
|
||||
$albumId =$album['id'];
|
||||
$albumsId[] =$albumId;
|
||||
@@ -358,7 +358,9 @@ class VehicleNewService extends BaseService
|
||||
$albumsourceFields
|
||||
);
|
||||
}
|
||||
VehicleNewAlbumModel::whereNotIn('id', $traitsId)->where('vehicle_id',$id)->delete();
|
||||
|
||||
$contentsId = [];
|
||||
foreach ($contents as $content) {
|
||||
$contentsourceFields = $VehicleNewContentService->extractSourceFields($content);
|
||||
$content['vehicle_id'] = $id;
|
||||
@@ -368,7 +370,6 @@ class VehicleNewService extends BaseService
|
||||
// throw new BusinessException('提交失败');
|
||||
// }
|
||||
|
||||
$contentsId = [];
|
||||
if(!empty($content['id'])){
|
||||
$contentId =$content['id'];
|
||||
$contentsId[] =$contentId;
|
||||
|
||||
Reference in New Issue
Block a user