feat : oss
This commit is contained in:
@@ -10,6 +10,8 @@ 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
|
||||
@@ -20,4 +22,19 @@ class ThirdController extends AbstractController
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user