update
This commit is contained in:
@@ -45,7 +45,12 @@ class CatchUpload
|
||||
*/
|
||||
protected $path = '';
|
||||
|
||||
/**
|
||||
public function __construct()
|
||||
{
|
||||
$this->initDriver();
|
||||
}
|
||||
|
||||
/**
|
||||
* upload files
|
||||
*
|
||||
* @param UploadedFile $file
|
||||
@@ -77,6 +82,13 @@ class CatchUpload
|
||||
throw new FailedException('Upload Failed, Try Again!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地路径
|
||||
*
|
||||
* @time 2020年09月07日
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
protected function getLocalPath($path)
|
||||
{
|
||||
if ($this->getDriver() === self::LOCAL) {
|
||||
@@ -296,6 +308,21 @@ class CatchUpload
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @time 2020年09月07日
|
||||
* @return $this
|
||||
*/
|
||||
protected function initDriver()
|
||||
{
|
||||
if ($driver = Utils::config('site.upload')) {
|
||||
$this->driver = $driver;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取云存储的域名
|
||||
*
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace catcher;
|
||||
|
||||
use catchAdmin\system\model\Config;
|
||||
use think\facade\Db;
|
||||
use think\helper\Str;
|
||||
|
||||
@@ -129,4 +130,16 @@ class Utils
|
||||
{
|
||||
return request()->user()->id == config('catch.permissions.super_admin_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @time 2020年09月07日
|
||||
* @param $key
|
||||
* @return mixed
|
||||
*/
|
||||
public static function config($key)
|
||||
{
|
||||
return Config::where('key', $key)->value('value');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user