StorageController.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\controller\settings\shop;
  20. use app\adminapi\controller\BaseAdminController;
  21. use app\adminapi\logic\settings\shop\ShopStorageLogic;
  22. use app\adminapi\validate\settings\shop\StorageValidate;
  23. use app\common\service\ConfigService;
  24. use think\facade\Cache;
  25. use think\response\Json;
  26. /**
  27. * 存储设置控制器
  28. * Class StorageController
  29. * @package app\adminapi\controller\settings\shop
  30. */
  31. class StorageController extends BaseAdminController
  32. {
  33. /**
  34. * @notes 存储引擎列表
  35. * @return Json
  36. * @author suny
  37. * @date 2021/9/9 4:53 下午
  38. */
  39. public function lists()
  40. {
  41. return $this->success('获取成功', ShopStorageLogic::lists());
  42. }
  43. /**
  44. * @notes 存储配置信息
  45. * @return Json
  46. * @author suny
  47. * @date 2021/9/9 4:02 下午
  48. */
  49. public function index(): Json
  50. {
  51. $param = (new StorageValidate())->get()->goCheck('index');
  52. return $this->success('获取成功', ShopStorageLogic::index($param));
  53. }
  54. /**
  55. * @notes 设置存储参数
  56. * @author 张无忌
  57. * @date 2021/7/28 10:40
  58. */
  59. public function setup(): Json
  60. {
  61. $params = (new StorageValidate())->post()->goCheck('setup');
  62. $result = ShopStorageLogic::setup($params);
  63. if($result === true){
  64. return $this->success('配置成功',[],1,1);
  65. }else{
  66. return $this->success($result,[],1,1);
  67. }
  68. }
  69. /**
  70. * @notes 切换存储方式
  71. * @author suny
  72. * @date 2021/9/9 11:19 上午
  73. */
  74. public function change(): Json
  75. {
  76. $params = (new StorageValidate())->post()->goCheck('change');
  77. ShopStorageLogic::change($params);
  78. return $this->success('切换成功');
  79. }
  80. }