Przeglądaj źródła

调整接口:根据影片-获取影院列表

family 1 rok temu
rodzic
commit
9b8e1a9d7d

+ 30 - 1
app/common/repositories/movie/CinemaSchedRepository.php

@@ -9,6 +9,7 @@ namespace app\common\repositories\movie;
9
 
9
 
10
 use app\common\model\movie\cinema\CinemaSched;
10
 use app\common\model\movie\cinema\CinemaSched;
11
 use app\common\repositories\BaseRepository;
11
 use app\common\repositories\BaseRepository;
12
+use crmeb\services\ApiResponseService;
12
 use think\facade\Db;
13
 use think\facade\Db;
13
 
14
 
14
 /**
15
 /**
@@ -63,7 +64,35 @@ class CinemaSchedRepository extends BaseRepository
63
      * @throws \think\db\exception\DbException
64
      * @throws \think\db\exception\DbException
64
      * @throws \think\db\exception\ModelNotFoundException
65
      * @throws \think\db\exception\ModelNotFoundException
65
      */
66
      */
66
-    public function getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date, $show_time, $with = [], $order = 1)
67
+    public function getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $city_sign)
68
+    {
69
+        /** @var MovieRepository $movieRepository */
70
+        $movieRepository = app()->make(MovieRepository::class);
71
+        $result = $movieRepository->getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $city_sign);
72
+        $cinema_sched = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE))
73
+            ? $result['data']['list'] : [];
74
+        $count = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE))
75
+            ? $result['data']['paging']['total'] : 0;
76
+        $pages = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE))
77
+            ? $result['data']['paging']['pages'] : 0;
78
+
79
+        return compact('cinema_sched', 'count', 'pages');
80
+    }
81
+
82
+    /**
83
+     * @param $page
84
+     * @param $limit
85
+     * @param $longitude
86
+     * @param $latitude
87
+     * @param $show_date
88
+     * @param $with
89
+     * @param $order
90
+     * @return array
91
+     * @throws \think\db\exception\DataNotFoundException
92
+     * @throws \think\db\exception\DbException
93
+     * @throws \think\db\exception\ModelNotFoundException
94
+     */
95
+    public function getFilmSchedBak($page, $limit, $film_sign, $longitude, $latitude, $show_date, $show_time, $with = [], $order = 1)
67
     {
96
     {
68
         $field = 'sched_sign,cinema_sign,cinema_name,address,show_date,price,longitude,latitude';
97
         $field = 'sched_sign,cinema_sign,cinema_name,address,show_date,price,longitude,latitude';
69
         $where = ['film_sign' => $film_sign, 'show_date' => $show_date];
98
         $where = ['film_sign' => $film_sign, 'show_date' => $show_date];

+ 3 - 2
app/common/repositories/movie/DouHuoMallFilmApiRequest.php

@@ -144,7 +144,7 @@ class DouHuoMallFilmApiRequest
144
      * @param $film_sign
144
      * @param $film_sign
145
      * @return mixed|string
145
      * @return mixed|string
146
      */
146
      */
147
-    public static function getFilmSched($page = 1, $limit = 10, $film_sign = '', $longitude = '', $latitude = '')
147
+    public static function getFilmSched($page = 1, $limit = 10, $film_sign = '', $longitude = '', $latitude = '', $city_sign = '')
148
     {
148
     {
149
         $url = '/openapi/Movie/getFilmSched';
149
         $url = '/openapi/Movie/getFilmSched';
150
         $body = [
150
         $body = [
@@ -153,7 +153,8 @@ class DouHuoMallFilmApiRequest
153
             'limit' => $limit,
153
             'limit' => $limit,
154
             'film_sign' => $film_sign,
154
             'film_sign' => $film_sign,
155
             'longitude' => $longitude,
155
             'longitude' => $longitude,
156
-            'latitude' => $latitude
156
+            'latitude' => $latitude,
157
+            'city_sign' => $city_sign
157
         ];
158
         ];
158
 
159
 
159
         $res = self::curl_post(self::$path . $url, $body);
160
         $res = self::curl_post(self::$path . $url, $body);

+ 14 - 0
app/common/repositories/movie/MovieRepository.php

@@ -116,6 +116,20 @@ class MovieRepository extends BaseRepository
116
     }
116
     }
117
 
117
 
118
     /**
118
     /**
119
+     * @param $page
120
+     * @param $limit
121
+     * @param $film_sign
122
+     * @param $longitude
123
+     * @param $latitude
124
+     * @param $city_sign
125
+     * @return mixed|string
126
+     */
127
+    public function getFilmSched($page = 1, $limit = 10, $film_sign = '', $longitude = '', $latitude = '', $city_sign = '')
128
+    {
129
+        return DouHuoMallFilmApiRequest::getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $city_sign);
130
+    }
131
+
132
+    /**
119
      * @param $relation_id
133
      * @param $relation_id
120
      * @param $sched_sign
134
      * @param $sched_sign
121
      * @return mixed|string
135
      * @return mixed|string

+ 4 - 4
app/controller/api/movie/Movie.php

@@ -113,7 +113,7 @@ class Movie extends BaseController
113
     }
113
     }
114
 
114
 
115
     /**
115
     /**
116
-     * 根据影片、排片日期-获取影院列表
116
+     * 根据影片-获取影院列表
117
      *
117
      *
118
      * @return mixed
118
      * @return mixed
119
      */
119
      */
@@ -123,15 +123,15 @@ class Movie extends BaseController
123
         $film_sign = $this->request->param('film_sign', '');
123
         $film_sign = $this->request->param('film_sign', '');
124
         $longitude = $this->request->param('longitude', '');// 经度
124
         $longitude = $this->request->param('longitude', '');// 经度
125
         $latitude = $this->request->param('latitude', '');// 纬度
125
         $latitude = $this->request->param('latitude', '');// 纬度
126
-        $show_date = $this->request->param('show_date', '');
126
+        $city_sign = $this->request->param('city_sign', '');
127
 
127
 
128
         if (empty($film_sign)) return app('json')->fail('请选择要观看的影片');
128
         if (empty($film_sign)) return app('json')->fail('请选择要观看的影片');
129
         if (empty($longitude) || empty($latitude)) return app('json')->fail('请授权应用开启定位');
129
         if (empty($longitude) || empty($latitude)) return app('json')->fail('请授权应用开启定位');
130
-        if (empty($show_date)) return app('json')->fail('请选择观影日期');
130
+        if (empty($city_sign)) return app('json')->fail('请选择城市');
131
 
131
 
132
         /** @var CinemaSchedRepository $cinemaSchedRepository */
132
         /** @var CinemaSchedRepository $cinemaSchedRepository */
133
         $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
133
         $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
134
-        return app('json')->success($cinemaSchedRepository->getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date, date('H:i')));
134
+        return app('json')->success($cinemaSchedRepository->getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $city_sign));
135
     }
135
     }
136
 
136
 
137
     /**
137
     /**

+ 1 - 1
route/api.php

@@ -1281,7 +1281,7 @@ Route::group('api/', function () {
1281
         Route::get('cinema', '/getCinema'); // 影院列表
1281
         Route::get('cinema', '/getCinema'); // 影院列表
1282
         Route::get('film', '/getFilm'); // 影片列表
1282
         Route::get('film', '/getFilm'); // 影片列表
1283
         Route::get('filmsched_date', '/getFilmSchedDate'); // 影片场次日期
1283
         Route::get('filmsched_date', '/getFilmSchedDate'); // 影片场次日期
1284
-        Route::get('film_sched', '/getFilmSched'); // 根据影片排片日期查询排片影院
1284
+        Route::get('film_sched', '/getFilmSched'); // 根据影片查询排片影院
1285
         Route::get('cinemafilm_sched', '/getCinemaFilmSched'); // 根据影院影片场次日期查询场次列表
1285
         Route::get('cinemafilm_sched', '/getCinemaFilmSched'); // 根据影院影片场次日期查询场次列表
1286
         Route::get('sched_seat', '/getSchedSeat'); // 获取场次座位
1286
         Route::get('sched_seat', '/getSchedSeat'); // 获取场次座位
1287
     })->prefix('api.movie.Movie');
1287
     })->prefix('api.movie.Movie');