IndexController.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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\api\controller;
  15. use app\api\logic\IndexLogic;
  16. use think\response\Json;
  17. /**
  18. * index
  19. * Class IndexController
  20. * @package app\api\controller
  21. */
  22. class IndexController extends BaseApiController
  23. {
  24. public array $notNeedLogin = ['index', 'config', 'policy', 'decorate'];
  25. /**
  26. * @notes 首页数据
  27. * @return Json
  28. * @throws \think\db\exception\DataNotFoundException
  29. * @throws \think\db\exception\DbException
  30. * @throws \think\db\exception\ModelNotFoundException
  31. * @author 段誉
  32. * @date 2022/9/21 19:15
  33. */
  34. public function index()
  35. {
  36. $result = IndexLogic::getIndexData();
  37. return $this->data($result);
  38. }
  39. /**
  40. * @notes 全局配置
  41. * @return Json
  42. * @throws \think\db\exception\DataNotFoundException
  43. * @throws \think\db\exception\DbException
  44. * @throws \think\db\exception\ModelNotFoundException
  45. * @author 段誉
  46. * @date 2022/9/21 19:41
  47. */
  48. public function config()
  49. {
  50. $result = IndexLogic::getConfigData();
  51. return $this->data($result);
  52. }
  53. /**
  54. * @notes 政策协议
  55. * @return Json
  56. * @author 段誉
  57. * @date 2022/9/20 20:00
  58. */
  59. public function policy()
  60. {
  61. $type = $this->request->get('type/s', '');
  62. $result = IndexLogic::getPolicyByType($type);
  63. return $this->data($result);
  64. }
  65. /**
  66. * @notes 装修信息
  67. * @return Json
  68. * @author 段誉
  69. * @date 2022/9/21 18:37
  70. */
  71. public function decorate()
  72. {
  73. $id = $this->request->get('id/d');
  74. $result = IndexLogic::getDecorate($id);
  75. return $this->data($result);
  76. }
  77. }