- 抖音支持上传到云存储

v6
Chaim 4 years ago
parent 4156f8a080
commit 9f5408293a

@ -84,7 +84,7 @@ class OssService extends Service
try { try {
$ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint); $ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint);
$ossClient->uploadFile($this->bucket, $object, $filePath); $ossClient->uploadFile($this->bucket, $object, $filePath);
return $this->app->config->get('dtapp.aliyun.oss.url') . $filePath; return $this->app->config->get('dtapp.aliyun.oss.url') . $object;
} catch (OssException $e) { } catch (OssException $e) {
return $e->getMessage(); return $e->getMessage();
} }

@ -93,6 +93,6 @@ class BosService extends Service
// 从文件中直接上传Object // 从文件中直接上传Object
if (empty($this->bucket)) $this->getConfig(); if (empty($this->bucket)) $this->getConfig();
$client->putObjectFromFile($this->bucket, $object, $filePath); $client->putObjectFromFile($this->bucket, $object, $filePath);
return $this->app->config->get('dtapp.baidu.bos.url') . $filePath; return $this->app->config->get('dtapp.baidu.bos.url') . $object;
} }
} }

@ -24,6 +24,7 @@ use DtApp\ThinkLibrary\service\baidu\BosService;
use DtApp\ThinkLibrary\service\huaweicloud\ObsService; use DtApp\ThinkLibrary\service\huaweicloud\ObsService;
use DtApp\ThinkLibrary\service\StorageService; use DtApp\ThinkLibrary\service\StorageService;
use DtApp\ThinkLibrary\service\tencent\CosService; use DtApp\ThinkLibrary\service\tencent\CosService;
use Exception;
use stdClass; use stdClass;
/** /**
@ -192,6 +193,7 @@ class WatermarkService extends Service
/** /**
* 获取全部信息 * 获取全部信息
* @return $this * @return $this
* @throws Exception
*/ */
public function getAll() public function getAll()
{ {

@ -92,7 +92,7 @@ class ObsService extends Service
'SourceFile' => $filePath // localfile为待上传的本地文件路径需要指定到具体的文件名 'SourceFile' => $filePath // localfile为待上传的本地文件路径需要指定到具体的文件名
]); ]);
if (isset($resp['RequestId'])) { if (isset($resp['RequestId'])) {
return $this->app->config->get('dtapp.huaweicloud.obs.url') . $filePath; return $this->app->config->get('dtapp.huaweicloud.obs.url') . $object;
} else { } else {
return false; return false;
} }

@ -102,6 +102,6 @@ class CosService extends Service
'Body' => $file) 'Body' => $file)
); );
} }
return $this->app->config->get('dtapp.tencent.cos.url') . $filePath; return $this->app->config->get('dtapp.tencent.cos.url') . $object;
} }
} }

Loading…
Cancel
Save