1
This commit is contained in:
@@ -74,6 +74,10 @@ class SkuService
|
|||||||
*/
|
*/
|
||||||
public function beforeServiceStore($data, Request $request)
|
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 = [];
|
$spec = [];
|
||||||
foreach ($data['spec'] as $key => $value) {
|
foreach ($data['spec'] as $key => $value) {
|
||||||
$specItem = [];
|
$specItem = [];
|
||||||
@@ -93,27 +97,27 @@ class SkuService
|
|||||||
$data['image'] = implode(',',$data['image']);
|
$data['image'] = implode(',',$data['image']);
|
||||||
|
|
||||||
// 将OSS直连地址替换为代理地址
|
// 将OSS直连地址替换为代理地址
|
||||||
$ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
|
// $ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
|
||||||
$proxyPath = '/proxy/ossurl?file=';
|
// $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(
|
$data['desc'] = str_replace(
|
||||||
'?Expires=',
|
'?Expires=',
|
||||||
'&Expires=',
|
'&Expires=',
|
||||||
$data['desc']
|
$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;
|
return $data;
|
||||||
}
|
}
|
||||||
@@ -143,6 +147,10 @@ class SkuService
|
|||||||
*/
|
*/
|
||||||
public function beforeServiceUpdate($data, Request $request)
|
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 = [];
|
$spec = [];
|
||||||
SkuAttributeValue::where('sku_id', $data['id'])->delete();
|
SkuAttributeValue::where('sku_id', $data['id'])->delete();
|
||||||
foreach ($data['spec'] as $key => $value) {
|
foreach ($data['spec'] as $key => $value) {
|
||||||
@@ -163,27 +171,27 @@ class SkuService
|
|||||||
$data['image'] = implode(',',$data['image']);
|
$data['image'] = implode(',',$data['image']);
|
||||||
|
|
||||||
// 将OSS直连地址替换为代理地址
|
// 将OSS直连地址替换为代理地址
|
||||||
$ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
|
// $ossDomain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com/';
|
||||||
$proxyPath = '/proxy/ossurl?file=';
|
// $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(
|
$data['desc'] = str_replace(
|
||||||
'?Expires=',
|
'?Expires=',
|
||||||
'&Expires=',
|
'&Expires=',
|
||||||
$data['desc']
|
$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;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user