StorageController.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\setting;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\logic\setting\StorageLogic;
  17. use app\adminapi\validate\setting\StorageValidate;
  18. use think\response\Json;
  19. /**
  20. * 存储设置控制器
  21. * Class StorageController
  22. * @package app\adminapi\controller\setting\shop
  23. */
  24. class StorageController extends BaseAdminController
  25. {
  26. /**
  27. * @notes 获取存储引擎列表
  28. * @return Json
  29. * @author 段誉
  30. * @date 2022/4/20 16:13
  31. */
  32. public function lists()
  33. {
  34. return $this->success('获取成功', StorageLogic::lists());
  35. }
  36. /**
  37. * @notes 存储配置信息
  38. * @return Json
  39. * @author 段誉
  40. * @date 2022/4/20 16:19
  41. */
  42. public function detail()
  43. {
  44. $param = (new StorageValidate())->get()->goCheck('detail');
  45. return $this->success('获取成功', StorageLogic::detail($param));
  46. }
  47. /**
  48. * @notes 设置存储参数
  49. * @return Json
  50. * @author 段誉
  51. * @date 2022/4/20 16:19
  52. */
  53. public function setup()
  54. {
  55. $params = (new StorageValidate())->post()->goCheck('setup');
  56. $result = StorageLogic::setup($params);
  57. if (true === $result) {
  58. return $this->success('配置成功', [], 1, 1);
  59. }
  60. return $this->success($result, [], 1, 1);
  61. }
  62. /**
  63. * @notes 切换存储引擎
  64. * @return Json
  65. * @author 段誉
  66. * @date 2022/4/20 16:19
  67. */
  68. public function change()
  69. {
  70. $params = (new StorageValidate())->post()->goCheck('change');
  71. StorageLogic::change($params);
  72. return $this->success('切换成功', [], 1, 1);
  73. }
  74. }