MinioController.php 860 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller;
  4. use App\Service\MinioService;
  5. use Hyperf\HttpServer\Annotation\Controller;
  6. use Hyperf\HttpServer\Annotation\RequestMapping;
  7. use Psr\Http\Message\ResponseInterface;
  8. use function Sodium\version_string;
  9. use App\Tools\Result;
  10. class MinioController extends AbstractController
  11. {
  12. /**
  13. * @Inject
  14. * @var MinioService
  15. */
  16. protected $minioService;
  17. /**
  18. * 获取所有MinIO存储桶列表
  19. *
  20. * @RequestMapping(path="buckets", methods="get")
  21. */
  22. public function listBuckets()
  23. {
  24. $result = new MinioService();
  25. // 调用服务层的方法获取存储桶列表
  26. $bucketsResponse =$result->listBuckets();
  27. // 直接返回服务层生成的响应
  28. return Result::success($bucketsResponse);
  29. }
  30. }