Merge branch 'feature/article' into develop
This commit is contained in:
@@ -123,6 +123,12 @@ class ArticleController extends BaseController
|
||||
|
||||
public function edit(Request $request, int $id): Response
|
||||
{
|
||||
$request->setPost('user_id', $request->user['id']);
|
||||
|
||||
$protocol = $request->header('x-forwarded-proto',
|
||||
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http');
|
||||
$domain = $protocol . '://' . $request->host();
|
||||
$request->setPost('domain', $domain);
|
||||
try {
|
||||
return $this->getService()->edit($request->all(), $id)
|
||||
? $this->successResponse()
|
||||
|
||||
@@ -118,6 +118,22 @@ class ArticleService extends BaseService
|
||||
$num = $params['num'] ?? 0;
|
||||
unset($params['num']);
|
||||
|
||||
// 将OSS直连地址替换为代理地址
|
||||
$ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
|
||||
$proxyPath = $params['domain'].'/console/upload/image/proxy?file=';
|
||||
unset($params['domain']);
|
||||
|
||||
$params['content'] = str_replace(
|
||||
'?Expires=',
|
||||
'&Expires=',
|
||||
$params['content']
|
||||
);
|
||||
$params['content'] = str_replace(
|
||||
$ossDomain,
|
||||
$proxyPath,
|
||||
$params['content']
|
||||
);
|
||||
|
||||
Db::beginTransaction();
|
||||
try {
|
||||
$info = $this->update($id, $params);
|
||||
|
||||
@@ -173,12 +173,12 @@ class BrandService extends BaseService
|
||||
}
|
||||
|
||||
// 异步翻译并写入 hs_vehicle_data_translation 表
|
||||
(new TranslationService())->queueTranslations(
|
||||
'brand',
|
||||
$id,
|
||||
$sourceLocale,
|
||||
$sourceFields
|
||||
);
|
||||
// (new TranslationService())->queueTranslations(
|
||||
// 'brand',
|
||||
// $id,
|
||||
// $sourceLocale,
|
||||
// $sourceFields
|
||||
// );
|
||||
|
||||
//品牌轮播图
|
||||
$bannersId = [];
|
||||
@@ -204,12 +204,12 @@ class BrandService extends BaseService
|
||||
$bannersId[] = $bannerId;
|
||||
}
|
||||
|
||||
(new TranslationService())->queueTranslations(
|
||||
'brandBanner',
|
||||
$bannerId,
|
||||
$sourceLocale,
|
||||
$bannersourceFields
|
||||
);
|
||||
// (new TranslationService())->queueTranslations(
|
||||
// 'brandBanner',
|
||||
// $bannerId,
|
||||
// $sourceLocale,
|
||||
// $bannersourceFields
|
||||
// );
|
||||
}
|
||||
BrandBannerModel::whereNotIn('id', $bannersId)->where('brand_id',$id)->delete();
|
||||
|
||||
@@ -237,12 +237,12 @@ class BrandService extends BaseService
|
||||
$traitsId[] = $traitId;
|
||||
}
|
||||
|
||||
(new TranslationService())->queueTranslations(
|
||||
'brandTrait',
|
||||
$traitId,
|
||||
$sourceLocale,
|
||||
$traitsourceFields
|
||||
);
|
||||
// (new TranslationService())->queueTranslations(
|
||||
// 'brandTrait',
|
||||
// $traitId,
|
||||
// $sourceLocale,
|
||||
// $traitsourceFields
|
||||
// );
|
||||
}
|
||||
BrandTraitModel::whereNotIn('id', $traitsId)->where('brand_id',$id)->delete();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user