diff --git a/crmeb/config/upload.php b/crmeb/config/upload.php index 782ec145c..864bfea63 100644 --- a/crmeb/config/upload.php +++ b/crmeb/config/upload.php @@ -57,5 +57,20 @@ return [ 'AccessKeySecret' => '', //sys_config('tengxun_secretKey') 'APPID' => '', //sys_config('tengxun_appid') ], + //oss 京东云 + 'jdoss' => [ + 'AccessKeyId' => '', // sys_config('accessKey') + 'AccessKeySecret' => '', // sys_config('secretKey') + ], + //oss 华为云 + 'obs' => [ + 'AccessKeyId' => '', // sys_config('accessKey') + 'AccessKeySecret' => '', // sys_config('secretKey') + ], + //oss 天翼云 + 'tyoss' => [ + 'AccessKeyId' => '', // sys_config('accessKey') + 'AccessKeySecret' => '', // sys_config('secretKey') + ], ] ]; diff --git a/crmeb/crmeb/services/upload/storage/Jdoss.php b/crmeb/crmeb/services/upload/storage/Jdoss.php new file mode 100644 index 000000000..106085445 --- /dev/null +++ b/crmeb/crmeb/services/upload/storage/Jdoss.php @@ -0,0 +1,190 @@ + 'northwest',//:左上 + '2' => 'north',//:中上 + '3' => 'northeast',//:右上 + '4' => 'west',//:左中 + '5' => 'center',//:中部 + '6' => 'east',//:右中 + '7' => 'southwest',//:左下 + '8' => 'south',//:中下 + '9' => 'southeast',//:右下 + ]; + + /** + * 初始化 + * @param array $config + * @return mixed|void + */ + public function initialize(array $config) + { + parent::initialize($config); + $this->accessKey = $config['accessKey'] ?? null; + $this->secretKey = $config['secretKey'] ?? null; + $this->uploadUrl = $this->checkUploadUrl($config['uploadUrl'] ?? ''); + $this->storageName = $config['storageName'] ?? null; + $this->storageRegion = $config['storageRegion'] ?? null; + $this->cdn = $config['cdn'] ?? null; + $this->waterConfig['watermark_text_font'] = 'simfang仿宋.ttf'; + } + + /** + * 实例化cos + * @return CrmebClient + */ + protected function app() + { + $this->handle = new CrmebClient([ + 'accessKey' => $this->accessKey, + 'secretKey' => $this->secretKey, + 'region' => $this->storageRegion, + 'bucket' => $this->storageName, + 'uploadUrl' => $this->uploadUrl + ]); + return $this->handle; + } + + public function move(string $file = 'file') + { + // TODO: Implement move() method. + } + + public function stream($fileContent, string $key = null) + { + // TODO: Implement stream() method. + } + + public function delete(string $filePath) + { + // TODO: Implement delete() method. + } + + + public function listbuckets(string $region, bool $line = false, bool $shared = false) + { + try { + $res = $this->app()->listBuckets(); + return $res['Buckets']['Bucket'] ?? []; + } catch (\Throwable $e) { + return []; + } + } + + public function createBucket(string $name, string $region) + { + // TODO: Implement createBucket() method. + } + + public function getRegion() + { + return [ + [ + 'value' => 'cn-north-1', + 'label' => '华北-北京' + ], + [ + 'value' => 'cn-east-1', + 'label' => '华东-宿迁' + ], + [ + 'value' => 'cn-east-2', + 'label' => '华东-上海' + ], + [ + 'value' => 'cn-south-1', + 'label' => '华南-广州' + ] + ]; + } + + public function deleteBucket(string $name) + { + // TODO: Implement deleteBucket() method. + } + + public function bindDomian(string $name, string $domain, string $region = null) + { + // TODO: Implement bindDomian() method. + } + + public function setBucketCors(string $name, string $region) + { + // TODO: Implement setBucketCors() method. + } + + public function getTempKeys() + { + // TODO: Implement getTempKeys() method. + } + + public function thumb(string $filePath = '') + { + // TODO: Implement thumb() method. + } + + public function water(string $filePath = '') + { + // TODO: Implement water() method. + } +}