IndexController.php 3.1 KB

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