IndexController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. $work = ServiceWork::where('id',44)->findOrEmpty();
  41. $order_sns = RechargeOrder::where('work_id',$work->id)->column('sn');
  42. $goods_id = OrderGoods::whereIn('sn',$order_sns)->value('goods_id');
  43. dd($goods_id);
  44. $result = IndexLogic::getIndexData();
  45. return $this->data($result);
  46. }
  47. /**
  48. * @notes 全局配置
  49. * @return Json
  50. * @throws \think\db\exception\DataNotFoundException
  51. * @throws \think\db\exception\DbException
  52. * @throws \think\db\exception\ModelNotFoundException
  53. * @author 段誉
  54. * @date 2022/9/21 19:41
  55. */
  56. public function config()
  57. {
  58. $result = IndexLogic::getConfigData();
  59. return $this->data($result);
  60. }
  61. /**
  62. * 客服电话
  63. * @return \think\response\Json
  64. */
  65. public function customerPhone()
  66. {
  67. $result = DictData::where(['type_value' => 'customer_support'])->column('value', 'name');
  68. return $this->data($result);
  69. }
  70. /**
  71. * @notes 政策协议
  72. * @return Json
  73. * @author 段誉
  74. * @date 2022/9/20 20:00
  75. */
  76. public function policy()
  77. {
  78. $type = $this->request->get('type/s', '');
  79. $result = IndexLogic::getPolicyByType($type);
  80. return $this->data($result);
  81. }
  82. /**
  83. * @notes 装修信息
  84. * @return Json
  85. * @author 段誉
  86. * @date 2022/9/21 18:37
  87. */
  88. public function decorate()
  89. {
  90. $id = $this->request->get('id/d');
  91. $result = IndexLogic::getDecorate($id);
  92. return $this->data($result);
  93. }
  94. }