12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- // +—————————————————————————————————————————————————————————————————————
- // | Created by Yunbao
- // +—————————————————————————————————————————————————————————————————————
- // | Copyright (c) 2013~2022 http://www.yunbaokj.com All rights reserved.
- // +—————————————————————————————————————————————————————————————————————
- // | Author: https://gitee.com/yunbaokeji
- // +—————————————————————————————————————————————————————————————————————
- // | Date: 2022-02-17
- // +—————————————————————————————————————————————————————————————————————
- namespace app\admin\controller;
- use cmf\controller\AdminBaseController;
- class StorageController extends AdminBaseController
- {
- /**
- * 文件存储
- * @adminMenu(
- * 'name' => '文件存储',
- * 'parent' => 'admin/Setting/default',
- * 'display'=> true,
- * 'hasView'=> true,
- * 'order' => 10000,
- * 'icon' => '',
- * 'remark' => '文件存储',
- * 'param' => ''
- * )
- */
- public function index()
- {
- $storage = cmf_get_option('storage');
- /*var_dump($storage);
- die;*/
- if (empty($storage)) {
- $storage['type'] = 'Local';
- $storage['storages'] = ['Local' => ['name' => '本地']];
- } else {
- if (empty($storage['type'])) {
- $storage['type'] = 'Local';
- }
- if (empty($storage['storages']['Local'])) {
- $storage['storages']['Local'] = ['name' => '本地'];
- }
- }
- $this->assign($storage);
- return $this->fetch();
- }
- /**
- * 文件存储
- * @adminMenu(
- * 'name' => '文件存储设置提交',
- * 'parent' => 'index',
- * 'display'=> false,
- * 'hasView'=> false,
- * 'order' => 10000,
- * 'icon' => '',
- * 'remark' => '文件存储设置提交',
- * 'param' => ''
- * )
- */
- public function settingPost()
- {
- $post = $this->request->post();
- $storage = cmf_get_option('storage');
-
-
- if($storage['type']!=$post['type']){
- $type=[
- 'Local'=>'本地',
- 'Qiniu'=>'七牛云存储'
- ];
-
- }
- $storage['type'] = $post['type'];
- cmf_set_option('storage', $storage);
-
-
-
- $this->success("设置成功!", '');
- }
- }
|