MinioController.php 889 B

12345678910111213141516171819202122232425262728293031323334353637
  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. class MinioController extends AbstractController
  10. {
  11. /**
  12. * @Inject
  13. * @var MinioService
  14. */
  15. protected $minioService;
  16. /**
  17. * 获取所有MinIO存储桶列表
  18. *
  19. * @RequestMapping(path="buckets", methods="get")
  20. */
  21. public function listBuckets()
  22. {
  23. var_dump("====");
  24. $a = new MinioService();
  25. // 调用服务层的方法获取存储桶列表
  26. $bucketsResponse =$a->listBuckets();
  27. var_dump("试试:",$bucketsResponse);
  28. // 直接返回服务层生成的响应
  29. return $bucketsResponse;
  30. }
  31. }