|
|
@@ -57,9 +57,7 @@ class CinemaSchedCommand extends Command
|
|
57
|
57
|
$cinema_filmRepository = app()->make(MovieRepository::class);
|
|
58
|
58
|
$cinema_sched = $cinema_filmRepository->getCinemaSched($film['film_sign'], $cinema['cinema_sign']);
|
|
59
|
59
|
|
|
60
|
|
- if (isset($cinema_sched['code']) && ($cinema_sched['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE)) {
|
|
61
|
|
- $this->createCinemaSched($cinema_sched['data']['list'], $cinema);
|
|
62
|
|
- }
|
|
|
60
|
+ $this->createCinemaSched($cinema_sched, $cinema);
|
|
63
|
61
|
}
|
|
64
|
62
|
|
|
65
|
63
|
/**
|
|
|
@@ -72,35 +70,37 @@ class CinemaSchedCommand extends Command
|
|
72
|
70
|
*/
|
|
73
|
71
|
private function createCinemaSched($list, $cinema)
|
|
74
|
72
|
{
|
|
75
|
|
- foreach ($list as $key => $value) {
|
|
76
|
|
- $params = [
|
|
77
|
|
- 'relation_id' => $value['relation_id'],
|
|
78
|
|
- 'sched_sign' => $value['sched_sign'],
|
|
79
|
|
- 'film_sign' => $value['film_sign'],
|
|
80
|
|
- 'film_name' => $value['film_name'],
|
|
81
|
|
- 'show_date' => strtotime(date('Y') . '-' . $value['show_date']),
|
|
82
|
|
- 'show_time' => trim($value['show_time']),
|
|
83
|
|
- 'cinema_sign' => $cinema['cinema_sign'],
|
|
84
|
|
- 'cinema_name' => $cinema['cinema_name'],
|
|
85
|
|
- 'address' => $cinema['address'],
|
|
86
|
|
- 'longitude' => $cinema['longitude'],
|
|
87
|
|
- 'latitude' => $cinema['latitude'],
|
|
88
|
|
- 'hall_sign' => $value['hall_sign'],
|
|
89
|
|
- 'hall_name' => $value['hall_name'],
|
|
90
|
|
- 'stop_sell_time' => $value['stop_sell_time'],
|
|
91
|
|
- 'cost_price' => $value['cost_price'],
|
|
92
|
|
- 'channel_price' => json_encode($value['channel_price'], JSON_FORCE_OBJECT)
|
|
93
|
|
- ];
|
|
94
|
|
- $where = [
|
|
95
|
|
- 'relation_id' => $value['relation_id'], 'sched_sign' => $value['sched_sign'], 'film_sign' => $value['film_sign'], 'cinema_sign' => $params['cinema_sign']
|
|
96
|
|
- ];
|
|
97
|
|
- $model = Db::name('movie_cinema_sched')->where($where)->find();
|
|
98
|
|
- if (empty($model)) {
|
|
99
|
|
- $params['create_time'] = time();
|
|
100
|
|
- Db::name('movie_cinema_sched')->insert($params);
|
|
101
|
|
- } else {
|
|
102
|
|
- $params['update_time'] = time();
|
|
103
|
|
- Db::name('movie_cinema_sched')->where('id', $model['id'])->update($params);
|
|
|
73
|
+ foreach ($list as $key => $sched) {
|
|
|
74
|
+ foreach ($sched as $subKey => $value) {
|
|
|
75
|
+ $params = [
|
|
|
76
|
+ 'relation_id' => $value['relation_id'],
|
|
|
77
|
+ 'sched_sign' => $value['sched_sign'],
|
|
|
78
|
+ 'film_sign' => $value['film_sign'],
|
|
|
79
|
+ 'film_name' => $value['film_name'],
|
|
|
80
|
+ 'show_date' => strtotime(date('Y') . '-' . $value['show_date']),
|
|
|
81
|
+ 'show_time' => trim($value['show_time']),
|
|
|
82
|
+ 'cinema_sign' => $cinema['cinema_sign'],
|
|
|
83
|
+ 'cinema_name' => $cinema['cinema_name'],
|
|
|
84
|
+ 'address' => $cinema['address'],
|
|
|
85
|
+ 'longitude' => $cinema['longitude'],
|
|
|
86
|
+ 'latitude' => $cinema['latitude'],
|
|
|
87
|
+ 'hall_sign' => $value['hall_sign'],
|
|
|
88
|
+ 'hall_name' => $value['hall_name'],
|
|
|
89
|
+ 'stop_sell_time' => strtotime($value['stop_sell_time']),
|
|
|
90
|
+ 'cost_price' => $value['cost_price'],
|
|
|
91
|
+ 'channel_price' => json_encode($value['channel_price'], JSON_FORCE_OBJECT)
|
|
|
92
|
+ ];
|
|
|
93
|
+ $where = [
|
|
|
94
|
+ 'relation_id' => $value['relation_id'], 'sched_sign' => $value['sched_sign'], 'film_sign' => $value['film_sign'], 'cinema_sign' => $params['cinema_sign']
|
|
|
95
|
+ ];
|
|
|
96
|
+ $model = Db::name('movie_cinema_sched')->where($where)->find();
|
|
|
97
|
+ if (empty($model)) {
|
|
|
98
|
+ $params['create_time'] = time();
|
|
|
99
|
+ Db::name('movie_cinema_sched')->insert($params);
|
|
|
100
|
+ } else {
|
|
|
101
|
+ $params['update_time'] = time();
|
|
|
102
|
+ Db::name('movie_cinema_sched')->where('id', $model['id'])->update($params);
|
|
|
103
|
+ }
|
|
104
|
104
|
}
|
|
105
|
105
|
}
|
|
106
|
106
|
}
|