ConfigController.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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;
  15. use app\adminapi\logic\auth\AuthLogic;
  16. use app\adminapi\logic\ConfigLogic;
  17. /**
  18. * 配置控制器
  19. * Class ConfigController
  20. * @package app\adminapi\controller
  21. */
  22. class ConfigController extends BaseAdminController
  23. {
  24. public array $notNeedLogin = ['getConfig', 'dict'];
  25. /**
  26. * @notes 基础配置
  27. * @return \think\response\Json
  28. * @author 段誉
  29. * @date 2021/12/31 11:01
  30. */
  31. public function getConfig()
  32. {
  33. $data = ConfigLogic::getConfig();
  34. return $this->data($data);
  35. }
  36. /**
  37. * @notes 根据类型获取字典数据
  38. * @return \think\response\Json
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\DbException
  41. * @throws \think\db\exception\ModelNotFoundException
  42. * @author 段誉
  43. * @date 2022/9/27 19:10
  44. */
  45. public function dict()
  46. {
  47. $type = $this->request->get('type', '');
  48. $data = ConfigLogic::getDictByType($type);
  49. return $this->data($data);
  50. }
  51. }