StoreIntegralController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\api\controller\v1\activity;
  12. use app\Request;
  13. use app\services\activity\integral\StoreIntegralServices;
  14. class StoreIntegralController
  15. {
  16. protected $services;
  17. public function __construct(StoreIntegralServices $services)
  18. {
  19. $this->services = $services;
  20. }
  21. /**
  22. * 积分商城首页数据
  23. * @return mixed
  24. * @throws \think\db\exception\DataNotFoundException
  25. * @throws \think\db\exception\DbException
  26. * @throws \think\db\exception\ModelNotFoundException
  27. */
  28. public function index()
  29. {
  30. $data['banner'] = sys_data('integral_shop_banner') ?? [];//TODO 积分商城banner
  31. $where = ['is_show' => 1];
  32. $where['is_host'] = 1;
  33. $data['list'] = $this->services->getIntegralList($where);
  34. return app('json')->success(get_thumb_water($data, 'big'));
  35. }
  36. /**
  37. * 商品列表
  38. * @param Request $request
  39. * @return mixed
  40. */
  41. public function lst(Request $request)
  42. {
  43. $where = $request->getMore([
  44. ['store_name', ''],
  45. ['priceOrder', ''],
  46. ['salesOrder', ''],
  47. ]);
  48. $where['is_show'] = 1;
  49. $list = $this->services->getIntegralList($where);
  50. return app('json')->success(get_thumb_water($list, 'mid'));
  51. }
  52. /**
  53. * 积分商品详情
  54. * @param Request $request
  55. * @param $id
  56. * @return mixed
  57. */
  58. public function detail(Request $request, $id)
  59. {
  60. $data = $this->services->integralDetail($request, $id);
  61. return app('json')->success($data);
  62. }
  63. }