1
This commit is contained in:
@@ -68,15 +68,19 @@ class VehicleNewSkusService extends BaseService
|
||||
];
|
||||
}
|
||||
|
||||
// 声明需要多语言翻译
|
||||
protected array $translatable = [
|
||||
'name',
|
||||
];
|
||||
|
||||
public function add(array $params)
|
||||
{
|
||||
$sourceLocale = locale();
|
||||
// $sourceFields = $this->extractSourceFields($params);
|
||||
//
|
||||
// if (empty($sourceFields)) {
|
||||
// throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
|
||||
// };
|
||||
$sourceFields = $this->extractSourceFields($params);
|
||||
|
||||
if (empty($sourceFields)) {
|
||||
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
|
||||
};
|
||||
|
||||
$skuAttributes = $params['skuAttributes'];
|
||||
unset($params['skuAttributes']);
|
||||
@@ -91,13 +95,13 @@ class VehicleNewSkusService extends BaseService
|
||||
throw new BusinessException('提交失败');
|
||||
}
|
||||
|
||||
// 异步翻译并写入 hs_vehicle_data_translation 表
|
||||
// (new TranslationService())->queueTranslations(
|
||||
// 'vehicleNewAttributes',
|
||||
// $info->id,
|
||||
// $sourceLocale,
|
||||
// $sourceFields
|
||||
// );
|
||||
// 异步翻译并写入 hs_vehicle_new_skus_translation 表
|
||||
(new TranslationService())->queueTranslations(
|
||||
'vehicleNewSku',
|
||||
$info->id,
|
||||
$sourceLocale,
|
||||
$sourceFields
|
||||
);
|
||||
|
||||
foreach ($skuAttributes as $skuAttribute) {
|
||||
$skuAttribute['sku_id'] = $info->id;
|
||||
@@ -118,11 +122,11 @@ class VehicleNewSkusService extends BaseService
|
||||
public function edit(array $params, int $id)
|
||||
{
|
||||
$sourceLocale = locale();
|
||||
// $sourceFields = $this->extractSourceFields($params);
|
||||
//
|
||||
// if (empty($sourceFields)) {
|
||||
// throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
|
||||
// };
|
||||
$sourceFields = $this->extractSourceFields($params);
|
||||
|
||||
if (empty($sourceFields)) {
|
||||
throw new \InvalidArgumentException("请传递至少一条 {$sourceLocale} 语言的翻译字段");
|
||||
};
|
||||
|
||||
$skuAttributes = $params['skuAttributes'];
|
||||
unset($params['skuAttributes']);
|
||||
@@ -134,13 +138,13 @@ class VehicleNewSkusService extends BaseService
|
||||
throw new BusinessException('提交失败');
|
||||
}
|
||||
|
||||
// 异步翻译并写入 hs_vehicle_data_translation 表
|
||||
// (new TranslationService())->queueTranslations(
|
||||
// 'vehicleNewAttributes',
|
||||
// $id,
|
||||
// $sourceLocale,
|
||||
// $sourceFields
|
||||
// );
|
||||
//异步翻译并写入 hs_vehicle_new_skus_translation 表
|
||||
(new TranslationService())->queueTranslations(
|
||||
'vehicleNewSku',
|
||||
$id,
|
||||
$sourceLocale,
|
||||
$sourceFields
|
||||
);
|
||||
|
||||
|
||||
$skuAttributesId = [];
|
||||
|
||||
Reference in New Issue
Block a user