开始实现使用内部的上传逻辑;

This commit is contained in:
2022-07-11 17:41:20 +08:00
parent 5081cd8790
commit 3078dfad39
12 changed files with 396 additions and 777 deletions

View File

@@ -3,6 +3,7 @@
use app\common\service\AuthService;
use think\facade\Cache;
use think\facade\Request;
use think\route\Url;
if (!function_exists('__url')) {
@@ -219,3 +220,28 @@ if (!function_exists('unparse_url')) {
return "$scheme$user$pass$host$port$path$query$fragment";
}
}
function build_upload_url($url)
{
$config = sysconfig('upload');
$upload_type = $config['upload_type'] ?? 'local_public';
$prefix_url = '';
switch ($upload_type) {
case 'local_public':
$prefix_url = Request::domain();
break;
case 'qnoss':
$prefix_url = $config['qnoss_domain'];
break;
default:
# code...
break;
}
return trim($prefix_url, '/') . '/' . trim($url, '/');
}