1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\adminapi\controller\upload;
- use app\dict\sys\StorageDict;
- use app\service\admin\upload\StorageConfigService;
- use core\base\BaseAdminController;
- use core\exception\AdminException;
- use think\Response;
- class Storage extends BaseAdminController
- {
-
- public function storageList()
- {
- $res = (new StorageConfigService())->getStorageList();
- return success($res);
- }
-
- public function storageConfig($storage_type)
- {
- $res = (new StorageConfigService())->getStorageConfig($storage_type);
- return success($res);
- }
-
- public function editStorage($storage_type)
- {
-
- $storage_type_list = StorageDict::getType();
- if (!array_key_exists($storage_type, $storage_type_list)) throw new AdminException('OSS_TYPE_NOT_EXIST');
-
- $data = [
- ['is_use', 0]
- ];
- foreach ($storage_type_list[$storage_type]['params'] as $k_param => $v_param) {
- $data[] = [$k_param, ''];
- }
- $request_data = $this->request->params($data);
- (new StorageConfigService())->setStorageConfig($storage_type, $request_data);
- return success('SET_SUCCESS');
- }
- }
|