This commit is contained in:
2025-12-12 17:00:20 +08:00
parent f256bc4bcb
commit 6db97c4afe
+39 -31
View File
@@ -74,6 +74,10 @@ class SkuService
*/
public function beforeServiceStore($data, Request $request)
{
$protocol = $request->header('x-forwarded-proto',
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http');
$domain = $protocol . '://' . $request->host();
$spec = [];
foreach ($data['spec'] as $key => $value) {
$specItem = [];
@@ -93,27 +97,27 @@ class SkuService
$data['image'] = implode(',',$data['image']);
// 将OSS直连地址替换为代理地址
$ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
$proxyPath = '/proxy/ossurl?file=';
// $ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
// $proxyPath = '/proxy/ossurl?file=';
//
// $data['desc'] = str_replace(
// $ossDomain,
// $proxyPath,
// $data['desc']
// );
// 将OSS直连地址替换为代理地址
$ossDomain = 'https://static.hnzhwlkj.cn/';
$proxyPath = $domain.'/proxy/ossurl?file=';
$data['desc'] = str_replace(
$ossDomain,
$proxyPath,
$data['desc']
);
$data['desc'] = str_replace(
'?Expires=',
'&Expires=',
$data['desc']
);
$data['desc'] = str_replace(
$ossDomain,
$proxyPath,
$data['desc']
);
// 将OSS直连地址替换为代理地址
$ossDomain = 'https://static.hnzhwlkj.cn/';
$proxyPath = '/proxy/ossurl?file=';
$data['desc'] = str_replace(
$ossDomain,
$proxyPath,
$data['desc']
);
return $data;
}
@@ -143,6 +147,10 @@ class SkuService
*/
public function beforeServiceUpdate($data, Request $request)
{
$protocol = $request->header('x-forwarded-proto',
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http');
$domain = $protocol . '://' . $request->host();
$spec = [];
SkuAttributeValue::where('sku_id', $data['id'])->delete();
foreach ($data['spec'] as $key => $value) {
@@ -163,27 +171,27 @@ class SkuService
$data['image'] = implode(',',$data['image']);
// 将OSS直连地址替换为代理地址
$ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
$proxyPath = '/proxy/ossurl?file=';
// $ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
// $proxyPath = '/proxy/ossurl?file=';
// $data['desc'] = str_replace(
// $ossDomain,
// $proxyPath,
// $data['desc']
// );
// 将OSS直连地址替换为代理地址
$ossDomain = 'https://static.hnzhwlkj.cn/';
$proxyPath = $domain.'/proxy/ossurl?file=';
$data['desc'] = str_replace(
$ossDomain,
$proxyPath,
$data['desc']
);
$data['desc'] = str_replace(
'?Expires=',
'&Expires=',
$data['desc']
);
$data['desc'] = str_replace(
$ossDomain,
$proxyPath,
$data['desc']
);
// 将OSS直连地址替换为代理地址
$ossDomain = 'https://static.hnzhwlkj.cn/';
$proxyPath = '/proxy/ossurl?file=';
$data['desc'] = str_replace(
$ossDomain,
$proxyPath,
$data['desc']
);
return $data;
}