新增OSS,COS上传

This commit is contained in:
wolfcode
2023-09-06 18:19:28 +08:00
parent cf086a7b6c
commit e20e816816
11 changed files with 280 additions and 110 deletions

View File

@@ -21,6 +21,7 @@ class Config extends AdminController
{
parent::__construct($app);
$this->model = new SystemConfig();
$this->assign('upload_types', config('admin.upload_types'));
}
/**
@@ -39,12 +40,24 @@ class Config extends AdminController
$this->checkPostRequest();
$post = $this->request->post();
try {
$group = $post['group'] ?? '';
if (empty($group)) $this->error('保存失败');
if ($group == 'upload') {
$upload_types = config('admin.upload_types');
// 兼容旧版本
$this->model->where('name', 'upload_allow_type')->update(['value' => implode(',', array_keys($upload_types))]);
}
foreach ($post as $key => $val) {
$this->model
->where('name', $key)
->update([
'value' => $val,
]);
if ($this->model->where('name', $key)->count()) {
$this->model->where('name', $key)->update(['value' => $val,]);
} else {
$this->model->save(
[
'name' => $key,
'value' => $val,
'group' => $group,
]);
}
}
TriggerService::updateMenu();
TriggerService::updateSysconfig();