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