feat: 获取 OSS 上传文件参数

This commit is contained in:
苟川东 2025-04-16 09:23:15 +08:00
parent e25a2c29ea
commit 3cd36d1301

View File

@ -0,0 +1,25 @@
<?php
namespace app\worker\controller;
use app\common\controller\WorkerApi;
class Common extends WorkerApi
{
public function ossParams()
{
$name = $this->request->post('name');
if (empty($name)) {
$this->error('文件名必填');
}
$md5 = md5($name);
$auth = new \addons\alioss\library\Auth();
$params = $auth->params($name, $md5);
$params['OSSAccessKeyId'] = $params['id'];
$params['success_action_status'] = 200;
$params['cdnurl'] = cdnurl('', true);
$this->success('', null, $params);
}
}