mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-31 06:50:51 +00:00
fix: 添加cdn域名
This commit is contained in:
parent
285b3ca92b
commit
0d57902b66
@ -202,6 +202,7 @@ class SystemStorage extends AuthController
|
||||
public function updateDomain($id)
|
||||
{
|
||||
$domain = $this->request->post('domain', '');
|
||||
$cdn = $this->request->post('cdn', '');
|
||||
$data = $this->request->postMore([
|
||||
['pri', ''],
|
||||
['ca', '']
|
||||
@ -217,7 +218,7 @@ class SystemStorage extends AuthController
|
||||
// return app('json')->fail('域名为HTTPS访问时,必须填写证书');
|
||||
// }
|
||||
|
||||
$this->services->updateDomain($id, $domain);
|
||||
$this->services->updateDomain($id, $domain, ['cdn' => $cdn]);
|
||||
|
||||
return app('json')->success(100001);
|
||||
}
|
||||
|
||||
@ -95,6 +95,7 @@ class UploadService
|
||||
$config['uploadUrl'] = $res['domain'];
|
||||
$config['storageName'] = $res['name'];
|
||||
$config['storageRegion'] = $res['region'];
|
||||
$config['cdn'] = $res['cdn'];
|
||||
}
|
||||
|
||||
$thumb = SystemConfigService::more(['thumb_big_height', 'thumb_big_width', 'thumb_mid_height', 'thumb_mid_width', 'thumb_small_height', 'thumb_small_width',]);
|
||||
|
||||
@ -425,11 +425,11 @@ class SystemStorageServices extends BaseServices
|
||||
*/
|
||||
public function getConfig(int $type)
|
||||
{
|
||||
$res = ['name' => '', 'region' => '', 'domain' => ''];
|
||||
$res = ['name' => '', 'region' => '', 'domain' => '', 'cdn' => ''];
|
||||
try {
|
||||
$config = $this->dao->get(['type' => $type, 'status' => 1, 'is_delete' => 0]);
|
||||
if ($config) {
|
||||
return ['name' => $config->name, 'region' => $config->region, 'domain' => $config->domain];
|
||||
return ['name' => $config->name, 'region' => $config->region, 'domain' => $config->domain, 'cdn' => $config->cdn];
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
@ -448,6 +448,7 @@ class SystemStorageServices extends BaseServices
|
||||
$domain = $this->dao->value(['id' => $id], 'domain');
|
||||
$rule = [
|
||||
FormBuilder::input('domain', '空间域名', $domain),
|
||||
FormBuilder::input('cdn', 'cdn域名', $domain),
|
||||
];
|
||||
return create_form('修改空间域名', $rule, '/system/config/storage/domain/' . $id);
|
||||
}
|
||||
@ -488,7 +489,11 @@ class SystemStorageServices extends BaseServices
|
||||
$resDomain = $upload->getDomianInfo($domain);
|
||||
$info->cname = $resDomain['cname'] ?? '';
|
||||
}
|
||||
return $info->save();
|
||||
$info->save();
|
||||
}
|
||||
if ($info->cdn != $data['cdn']) {
|
||||
$info->cdn = $data['cdn'];
|
||||
$info->save();
|
||||
}
|
||||
|
||||
$this->cacheDriver()->clear();
|
||||
|
||||
@ -175,10 +175,8 @@ class Client extends BaseClient
|
||||
*/
|
||||
public function putObject(string $key, $body, string $contentType = 'image/jpeg')
|
||||
{
|
||||
$url = $this->uploadUrl ?: $this->getRequestUrl($this->bucketName, $this->region);
|
||||
|
||||
$header = [
|
||||
'Host' => $url,
|
||||
'Host' => $this->getRequestUrl($this->bucketName, $this->region),
|
||||
'Content-Type' => $contentType,
|
||||
'Content-Length' => strlen($body),
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user