feat(upload): 添加华为 OBS 对象存储支持
- 在 addons.php 中添加了与华为 OBS 相关的钩子 - 新增了对华为 OBS 上传功能的实现,包括分片上传和合并 - 优化了上传参数处理和错误处理 - 支持客户端和服务端两种上传模式
This commit is contained in:
37
addons/hwobs/library/Auth.php
Normal file
37
addons/hwobs/library/Auth.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace addons\hwobs\library;
|
||||
|
||||
class Auth
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function isModuleAllow()
|
||||
{
|
||||
$config = get_addon_config('hwobs');
|
||||
$module = request()->module();
|
||||
$module = $module ? strtolower($module) : 'index';
|
||||
$noNeedLogin = array_filter(explode(',', $config['noneedlogin'] ?? ''));
|
||||
$isModuleLogin = false;
|
||||
$tagName = 'upload_config_checklogin';
|
||||
foreach (\think\Hook::get($tagName) as $index => $name) {
|
||||
if (\think\Hook::exec($name, $tagName)) {
|
||||
$isModuleLogin = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (in_array($module, $noNeedLogin)
|
||||
|| ($module == 'admin' && \app\admin\library\Auth::instance()->id)
|
||||
|| ($module != 'admin' && \app\common\library\Auth::instance()->id)
|
||||
|| $isModuleLogin) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user