diff --git a/app/common.php b/app/common.php index a9accb4..5070225 100644 --- a/app/common.php +++ b/app/common.php @@ -233,11 +233,14 @@ function build_upload_url($url) switch ($upload_type) { case 'local_public': - $prefix_url = Request::domain(); + // $prefix_url = Request::domain(); break; case 'qnoss': $prefix_url = $config['qnoss_domain']; break; + case 'alioss': + $prefix_url = $config['alioss_domain']; + break; default: # code... diff --git a/composer.json b/composer.json index 19a46c2..59b8d3f 100644 --- a/composer.json +++ b/composer.json @@ -23,15 +23,14 @@ "topthink/think-multi-app": "^1.0", "topthink/think-view": "^1.0", "topthink/think-captcha": "^3.0", - "aliyuncs/oss-sdk-php": "^2.3", "qcloud/cos-sdk-v5": "^2.0", - "alibabacloud/client": "^1.5", "zhongshaofa/easy-admin": "^1.0.2", "ext-json": "*", "guzzlehttp/guzzle": "^7.4", "phpoffice/phpspreadsheet": "^1.22", "topthink/think-migration": "^3.0", - "overtrue/flysystem-qiniu": "*" + "overtrue/flysystem-qiniu": "*", + "xxtime/flysystem-aliyun-oss": "^1.5" }, "require-dev": { "symfony/var-dumper": "^4.2", diff --git a/composer.lock b/composer.lock index 962f4d4..e09b8d2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,136 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fab1facb4504c56c26ac5202c66f3dda", + "content-hash": "111f94878583850a9fed799619afc3d7", "packages": [ - { - "name": "adbario/php-dot-notation", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/adbario/php-dot-notation.git", - "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e" - }, - "dist": { - "type": "zip", - "url": "https://repo.huaweicloud.com/repository/php/adbario/php-dot-notation/2.2.0/adbario-php-dot-notation-2.2.0.zip", - "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.0|^5.0|^6.0", - "squizlabs/php_codesniffer": "^3.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Adbar\\": "src" - } - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Riku Särkinen", - "email": "riku@adbar.io" - } - ], - "description": "PHP dot notation access to arrays", - "homepage": "https://github.com/adbario/php-dot-notation", - "keywords": [ - "ArrayAccess", - "dotnotation" - ], - "time": "2019-01-01T23:59:15+00:00" - }, - { - "name": "alibabacloud/client", - "version": "1.5.31", - "source": { - "type": "git", - "url": "https://github.com/aliyun/openapi-sdk-php-client.git", - "reference": "19224d92fe27ab8ef501d77d4891e7660bc023c1" - }, - "dist": { - "type": "zip", - "url": "https://repo.huaweicloud.com/repository/php/alibabacloud/client/1.5.31/alibabacloud-client-1.5.31.zip", - "reference": "19224d92fe27ab8ef501d77d4891e7660bc023c1", - "shasum": "" - }, - "require": { - "adbario/php-dot-notation": "^2.2", - "clagiordano/weblibs-configmanager": "^1.0", - "danielstjules/stringy": "^3.1", - "ext-curl": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-openssl": "*", - "ext-simplexml": "*", - "ext-xmlwriter": "*", - "guzzlehttp/guzzle": "^6.3|^7.0", - "mtdowling/jmespath.php": "^2.5", - "php": ">=5.5" - }, - "require-dev": { - "composer/composer": "^1.8", - "drupal/coder": "^8.3", - "ext-dom": "*", - "ext-pcre": "*", - "ext-sockets": "*", - "ext-spl": "*", - "league/climate": "^3.2.4", - "mikey179/vfsstream": "^1.6", - "monolog/monolog": "^1.24", - "phpunit/phpunit": "^5.7.27|^6.1", - "psr/cache": "^1.0", - "symfony/dotenv": "^3.4", - "symfony/var-dumper": "^3.4" - }, - "suggest": { - "ext-sockets": "To use client-side monitoring" - }, - "type": "library", - "autoload": { - "files": [ - "src/Functions.php" - ], - "psr-4": { - "AlibabaCloud\\Client\\": "src" - } - }, - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Alibaba Cloud SDK", - "email": "sdk-team@alibabacloud.com", - "homepage": "http://www.alibabacloud.com" - } - ], - "description": "Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project", - "homepage": "https://www.alibabacloud.com/", - "keywords": [ - "alibaba", - "alibabacloud", - "aliyun", - "client", - "cloud", - "library", - "sdk", - "tool" - ], - "time": "2021-05-13T06:26:38+00:00" - }, { "name": "aliyuncs/oss-sdk-php", "version": "v2.5.0", @@ -174,111 +46,6 @@ "homepage": "http://www.aliyun.com/product/oss/", "time": "2022-05-13T07:41:28+00:00" }, - { - "name": "clagiordano/weblibs-configmanager", - "version": "v1.5.0", - "source": { - "type": "git", - "url": "https://github.com/clagiordano/weblibs-configmanager.git", - "reference": "8802c7396d61a923c9a73e37ead062b24bb1b273" - }, - "dist": { - "type": "zip", - "url": "https://repo.huaweicloud.com/repository/php/clagiordano/weblibs-configmanager/v1.5.0/clagiordano-weblibs-configmanager-v1.5.0.zip", - "reference": "8802c7396d61a923c9a73e37ead062b24bb1b273", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=5.4", - "symfony/yaml": "^2.8" - }, - "require-dev": { - "clagiordano/phpunit-result-printer": "^1", - "php-coveralls/php-coveralls": "^1.1", - "phpunit/phpunit": "^4.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "clagiordano\\weblibs\\configmanager\\": "src/" - } - }, - "license": [ - "LGPL-3.0-or-later" - ], - "authors": [ - { - "name": "Claudio Giordano", - "email": "claudio.giordano@autistici.org", - "role": "Developer" - } - ], - "description": "weblibs-configmanager is a tool library for easily read and access to php config array file and direct read/write configuration file / object", - "keywords": [ - "clagiordano", - "configuration", - "manager", - "tool", - "weblibs" - ], - "time": "2021-07-12T15:27:21+00:00" - }, - { - "name": "danielstjules/stringy", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/danielstjules/Stringy.git", - "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" - }, - "dist": { - "type": "zip", - "url": "https://repo.huaweicloud.com/repository/php/danielstjules/stringy/3.1.0/danielstjules-stringy-3.1.0.zip", - "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Create.php" - ], - "psr-4": { - "Stringy\\": "src/" - } - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel St. Jules", - "email": "danielst.jules@gmail.com", - "homepage": "http://www.danielstjules.com" - } - ], - "description": "A string manipulation library with multibyte support", - "homepage": "https://github.com/danielstjules/Stringy", - "keywords": [ - "UTF", - "helpers", - "manipulation", - "methods", - "multibyte", - "string", - "utf-8", - "utility", - "utils" - ], - "time": "2017-06-12T01:10:27+00:00" - }, { "name": "doctrine/annotations", "version": "1.13.3", @@ -1358,62 +1125,6 @@ ], "time": "2021-07-01T19:01:15+00:00" }, - { - "name": "mtdowling/jmespath.php", - "version": "2.6.1", - "source": { - "type": "git", - "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb" - }, - "dist": { - "type": "zip", - "url": "https://repo.huaweicloud.com/repository/php/mtdowling/jmespath.php/2.6.1/mtdowling-jmespath.php-2.6.1.zip", - "reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb", - "shasum": "" - }, - "require": { - "php": "^5.4 || ^7.0 || ^8.0", - "symfony/polyfill-mbstring": "^1.17" - }, - "require-dev": { - "composer/xdebug-handler": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^7.5.15" - }, - "bin": [ - "bin/jp.php" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "files": [ - "src/JmesPath.php" - ], - "psr-4": { - "JmesPath\\": "src/" - } - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Declaratively specify how to extract elements from a JSON document", - "keywords": [ - "json", - "jsonpath" - ], - "time": "2021-06-14T00:11:39+00:00" - }, { "name": "myclabs/php-enum", "version": "1.8.3", @@ -2160,84 +1871,6 @@ ], "time": "2022-01-02T09:53:40+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.26.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" - }, - "dist": { - "type": "zip", - "url": "https://repo.huaweicloud.com/repository/php/symfony/polyfill-ctype/v1.26.0/symfony-polyfill-ctype-v1.26.0.zip", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-05-24T11:49:31+00:00" - }, { "name": "symfony/polyfill-mbstring", "version": "v1.26.0", @@ -2396,55 +2029,6 @@ ], "time": "2022-05-10T07:21:04+00:00" }, - { - "name": "symfony/yaml", - "version": "v2.8.52", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "02c1859112aa779d9ab394ae4f3381911d84052b" - }, - "dist": { - "type": "zip", - "url": "https://repo.huaweicloud.com/repository/php/symfony/yaml/v2.8.52/symfony-yaml-v2.8.52.zip", - "reference": "02c1859112aa779d9ab394ae4f3381911d84052b", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2018-11-11T11:18:13+00:00" - }, { "name": "topthink/framework", "version": "v6.0.12", @@ -2810,6 +2394,51 @@ "description": "thinkphp template driver", "time": "2019-11-06T11:40:13+00:00" }, + { + "name": "xxtime/flysystem-aliyun-oss", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/xxtime/flysystem-aliyun-oss.git", + "reference": "ae873b5919076157b9cfeaf39d2f56d2dbb39ee9" + }, + "dist": { + "type": "zip", + "url": "https://repo.huaweicloud.com/repository/php/xxtime/flysystem-aliyun-oss/1.5.0/xxtime-flysystem-aliyun-oss-1.5.0.zip", + "reference": "ae873b5919076157b9cfeaf39d2f56d2dbb39ee9", + "shasum": "" + }, + "require": { + "aliyuncs/oss-sdk-php": "~2.3", + "league/flysystem": "^1.0.49", + "php": ">=5.5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Xxtime\\Flysystem\\Aliyun\\": "src/" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joe", + "email": "joe@xxtime.com", + "homepage": "https://github.com/xxtime", + "role": "Developer" + } + ], + "description": "AliYun OSS adapter for flysystem. aliyuncs/oss-sdk-php ~2.3", + "homepage": "https://github.com/xxtime/flysystem-aliyun-oss", + "keywords": [ + "Flysystem", + "aliyun-oss", + "flysystem-aliyun-oss" + ], + "time": "2019-11-12T07:57:34+00:00" + }, { "name": "zhongshaofa/easy-admin", "version": "v1.0.2", diff --git a/config/filesystem.php b/config/filesystem.php index 807c5ca..9ced505 100644 --- a/config/filesystem.php +++ b/config/filesystem.php @@ -23,7 +23,10 @@ return [ ], 'qnoss' => [ 'type' => 'Qiniu' - ] + ], + 'alioss' => [ + 'type' => 'Alioss' + ], // 更多的磁盘配置信息 ], ]; diff --git a/extend/think/filesystem/driver/Alioss.php b/extend/think/filesystem/driver/Alioss.php new file mode 100644 index 0000000..b2b26be --- /dev/null +++ b/extend/think/filesystem/driver/Alioss.php @@ -0,0 +1,25 @@ + sysconfig('upload', 'alioss_access_key_id'), + 'accessSecret' => sysconfig('upload', 'alioss_access_key_secret'), + 'endpoint' => sysconfig('upload', 'alioss_endpoint'), + 'bucket' => sysconfig('upload', 'alioss_bucket'), + ]; + + return new OssAdapter( + $config + ); + } +}