41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Admin;
|
|
|
|
use App\Controller\AbstractController;
|
|
use App\Middleware\Admin\JwtAuthMiddleware;
|
|
use App\Service\Admin\Third\AliStsService;
|
|
use Hyperf\HttpServer\Annotation\Controller;
|
|
use Hyperf\HttpServer\Annotation\Middleware;
|
|
use Hyperf\HttpServer\Annotation\RequestMapping;
|
|
use OSS\OssClient;
|
|
use function Hyperf\Config\config;
|
|
|
|
#[Controller(prefix: "admin/third")]
|
|
class ThirdController extends AbstractController
|
|
{
|
|
#[RequestMapping(path: "sts/accredit", methods: "GET")]
|
|
#[Middleware(JwtAuthMiddleware::class)]
|
|
public function aliSts()
|
|
{
|
|
return (new AliStsService)->handle();
|
|
}
|
|
|
|
#[RequestMapping(path: "sts/test", methods: "GET")]
|
|
public function test()
|
|
{
|
|
$OssClient = new OssClient(
|
|
config('ali.access_key_id'),
|
|
config('ali.access_key_secret'),
|
|
config('ali.oss_endpoint')
|
|
);
|
|
$bucket = config('ali.bucket');
|
|
$url = 'upload/admin/menu/09bd10f1f526296cb3e9bfd624c799ac.jpeg';
|
|
$data= $OssClient->deleteObject($bucket, $url);
|
|
|
|
return $data;
|
|
}
|
|
}
|