IndexController.php 2.7 KB

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