StoreIntegralController.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\api\controller\v1\activity;
  3. use app\Request;
  4. use app\services\activity\integral\StoreIntegralServices;
  5. class StoreIntegralController
  6. {
  7. protected $services;
  8. public function __construct(StoreIntegralServices $services)
  9. {
  10. $this->services = $services;
  11. }
  12. /**
  13. * 积分商城首页数据
  14. * @return mixed
  15. * @throws \think\db\exception\DataNotFoundException
  16. * @throws \think\db\exception\DbException
  17. * @throws \think\db\exception\ModelNotFoundException
  18. */
  19. public function index()
  20. {
  21. $data['banner'] = sys_data('integral_shop_banner') ?? [];//TODO 积分商城banner
  22. $where = ['is_show' => 1];
  23. $where['is_host'] = 1;
  24. $data['list'] = $this->services->getIntegralList($where);
  25. return app('json')->success(get_thumb_water($data, 'big'));
  26. }
  27. /**
  28. * 商品列表
  29. * @param Request $request
  30. * @return mixed
  31. */
  32. public function lst(Request $request)
  33. {
  34. $where = $request->getMore([
  35. ['store_name', ''],
  36. ['priceOrder', ''],
  37. ['salesOrder', ''],
  38. ]);
  39. $where['is_show'] = 1;
  40. $list = $this->services->getIntegralList($where);
  41. return app('json')->success(get_thumb_water($list, 'mid'));
  42. }
  43. /**
  44. * 积分商品详情
  45. * @param Request $request
  46. * @param $id
  47. * @return mixed
  48. */
  49. public function detail(Request $request, $id)
  50. {
  51. $data = $this->services->integralDetail($request, $id);
  52. return app('json')->success($data);
  53. }
  54. }