StoreIntegralController.php 2.4 KB

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