Movie.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. /**
  3. * @package merchant
  4. * @Author: Qinii
  5. * @Date: 2020/5/27
  6. */
  7. namespace app\controller\api\movie;
  8. use app\common\repositories\movie\MovieRepository;
  9. use app\common\repositories\system\groupData\GroupDataRepository;
  10. use app\controller\merchant\user\User;
  11. use crmeb\basic\BaseController;
  12. use think\App;
  13. class Movie extends BaseController
  14. {
  15. /**
  16. * @var repository
  17. */
  18. protected $repository;
  19. protected $userInfo;
  20. private $source;
  21. private $merId;
  22. /**
  23. * StoreProduct constructor.
  24. * @param App $app
  25. * @param repository $repository
  26. */
  27. public function __construct(App $app, MovieRepository $repository)
  28. {
  29. parent::__construct($app);
  30. $this->repository = $repository;
  31. }
  32. /**
  33. * 获取城市列表
  34. *
  35. * @return mixed
  36. */
  37. public function getMovieCity()
  38. {
  39. [$page, $limit] = $this->getPage();
  40. $initial = $this->request->params(['initial']);
  41. $city_name = $this->request->params(['city_name']);
  42. return app('json')->success($this->repository->getMovieCity($page, $limit, $initial, $city_name));
  43. }
  44. /**
  45. * 获取城市分区列表
  46. *
  47. * @return mixed
  48. */
  49. public function getArea()
  50. {
  51. $city_sign = $this->request->params(['city_sign']);
  52. if (empty($city_sign)) return app('json')->fail('请选择城市');
  53. return app('json')->success($this->repository->getMovieArea($city_sign));
  54. }
  55. /**
  56. * 获取影院列表
  57. *
  58. * @return mixed
  59. */
  60. public function getCinema()
  61. {
  62. [$page, $limit] = $this->getPage();
  63. $city_sign = $this->request->params(['city_sign']);
  64. $area_sign = $this->request->params(['area_sign']);
  65. return app('json')->success($this->repository->getCinema($page, $limit, $city_sign, $area_sign));
  66. }
  67. /**
  68. * 获取影片列表
  69. *
  70. * @return mixed
  71. */
  72. public function getFilm()
  73. {
  74. [$page, $limit] = $this->getPage();
  75. $cinema_sign = $this->request->params(['cinema_sign']);
  76. $film_sign = $this->request->params(['film_sign']);
  77. return app('json')->success($this->repository->getFilm($page, $limit, $cinema_sign, $film_sign));
  78. }
  79. /**
  80. * 获取影院场次列表
  81. *
  82. * @return mixed
  83. */
  84. public function getCinemaSched()
  85. {
  86. $cinema_sign = $this->request->params(['cinema_sign']);
  87. if (empty($cinema_sign)) return app('json')->fail('请选择影院');
  88. $film_sign = $this->request->params(['film_sign']);
  89. if (empty($film_sign)) return app('json')->fail('请选择影片');
  90. return app('json')->success($this->repository->getCinemaSched($film_sign, $cinema_sign));
  91. }
  92. /**
  93. * 获取场次座位
  94. *
  95. * @return mixed
  96. */
  97. public function getSchedSeat()
  98. {
  99. $relation_id = $this->request->params(['relation_id']);
  100. if (empty($cinema_sign)) return app('json')->fail('请选择场次');
  101. $sched_sign = $this->request->params(['sched_sign']);
  102. if (empty($film_sign)) return app('json')->fail('请选择场次');
  103. return app('json')->success($this->repository->getSchedSeat($relation_id, $sched_sign));
  104. }
  105. //大仓会员商品列表
  106. public function dacang_lst()
  107. {
  108. [$page, $limit] = $this->getPage();
  109. $type = $this->request->param('type');
  110. if ($type == '2') {
  111. //银卡会员商品
  112. $product_id = explode('=', systemConfig('product_ids_yin'));
  113. } else {
  114. //金卡会员商品
  115. $product_id = explode('=', systemConfig('product_ids'));
  116. }
  117. $product_lst = Db::name('store_product')->page($page, $limit)->whereIn('product_id', $product_id)->field('image,store_name,product_id,sales')->select()->toArray();
  118. $count = Db::name('store_product')->whereIn('product_id', $product_id)->count('product_id');
  119. $ProductRepository = app()->make(repository::class);
  120. foreach ($product_lst as $k => &$v) {
  121. $v['yanglao'] = $ProductRepository->yanglaojin($v['product_id']);
  122. $product_attr_value = Db::name('store_product_attr_value')->where('product_id', $v['product_id'])->field('unique,ot_price,price')->find();
  123. $v['product_attr_unique'] = $product_attr_value['unique'];
  124. $v['ot_price'] = $product_attr_value['ot_price'];
  125. $v['price'] = $product_attr_value['price'];
  126. }
  127. $return_data = [
  128. 'list' => $product_lst,
  129. 'count' => $count
  130. ];
  131. return app('json')->success($return_data);
  132. }
  133. }