| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?php
- /**
- * @package merchant
- * @Author: Qinii
- * @Date: 2020/5/27
- */
- namespace app\controller\api\movie;
- use app\common\repositories\movie\MovieRepository;
- use app\common\repositories\system\groupData\GroupDataRepository;
- use app\controller\merchant\user\User;
- use crmeb\basic\BaseController;
- use think\App;
- class Movie extends BaseController
- {
- /**
- * @var repository
- */
- protected $repository;
- protected $userInfo;
- private $source;
- private $merId;
- /**
- * StoreProduct constructor.
- * @param App $app
- * @param repository $repository
- */
- public function __construct(App $app, MovieRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- /**
- * 获取城市列表
- *
- * @return mixed
- */
- public function getMovieCity()
- {
- [$page, $limit] = $this->getPage();
- $initial = $this->request->params(['initial']);
- $city_name = $this->request->params(['city_name']);
- return app('json')->success($this->repository->getMovieCity($page, $limit, $initial, $city_name));
- }
- /**
- * 获取城市分区列表
- *
- * @return mixed
- */
- public function getArea()
- {
- $city_sign = $this->request->params(['city_sign']);
- if (empty($city_sign)) return app('json')->fail('请选择城市');
- return app('json')->success($this->repository->getMovieArea($city_sign));
- }
- /**
- * 获取影院列表
- *
- * @return mixed
- */
- public function getCinema()
- {
- [$page, $limit] = $this->getPage();
- $city_sign = $this->request->params(['city_sign']);
- $area_sign = $this->request->params(['area_sign']);
- return app('json')->success($this->repository->getCinema($page, $limit, $city_sign, $area_sign));
- }
- /**
- * 获取影片列表
- *
- * @return mixed
- */
- public function getFilm()
- {
- [$page, $limit] = $this->getPage();
- $cinema_sign = $this->request->params(['cinema_sign']);
- $film_sign = $this->request->params(['film_sign']);
- return app('json')->success($this->repository->getFilm($page, $limit, $cinema_sign, $film_sign));
- }
- /**
- * 获取影院场次列表
- *
- * @return mixed
- */
- public function getCinemaSched()
- {
- $cinema_sign = $this->request->params(['cinema_sign']);
- if (empty($cinema_sign)) return app('json')->fail('请选择影院');
- $film_sign = $this->request->params(['film_sign']);
- if (empty($film_sign)) return app('json')->fail('请选择影片');
- return app('json')->success($this->repository->getCinemaSched($film_sign, $cinema_sign));
- }
- /**
- * 获取场次座位
- *
- * @return mixed
- */
- public function getSchedSeat()
- {
- $relation_id = $this->request->params(['relation_id']);
- if (empty($cinema_sign)) return app('json')->fail('请选择场次');
- $sched_sign = $this->request->params(['sched_sign']);
- if (empty($film_sign)) return app('json')->fail('请选择场次');
- return app('json')->success($this->repository->getSchedSeat($relation_id, $sched_sign));
- }
- //大仓会员商品列表
- public function dacang_lst()
- {
- [$page, $limit] = $this->getPage();
- $type = $this->request->param('type');
- if ($type == '2') {
- //银卡会员商品
- $product_id = explode('=', systemConfig('product_ids_yin'));
- } else {
- //金卡会员商品
- $product_id = explode('=', systemConfig('product_ids'));
- }
- $product_lst = Db::name('store_product')->page($page, $limit)->whereIn('product_id', $product_id)->field('image,store_name,product_id,sales')->select()->toArray();
- $count = Db::name('store_product')->whereIn('product_id', $product_id)->count('product_id');
- $ProductRepository = app()->make(repository::class);
- foreach ($product_lst as $k => &$v) {
- $v['yanglao'] = $ProductRepository->yanglaojin($v['product_id']);
- $product_attr_value = Db::name('store_product_attr_value')->where('product_id', $v['product_id'])->field('unique,ot_price,price')->find();
- $v['product_attr_unique'] = $product_attr_value['unique'];
- $v['ot_price'] = $product_attr_value['ot_price'];
- $v['price'] = $product_attr_value['price'];
- }
- $return_data = [
- 'list' => $product_lst,
- 'count' => $count
- ];
- return app('json')->success($return_data);
- }
- }
|