public function index()
 {
     $model = new \Home\Model\MovieModel();
     $data = $model->select('movie');
     $this->assign('allmovie', $data);
     $this->assign('movieurl', U('Movie/index'));
     //var_dump($data[1]);
     $this->assign('searchurl', U('Search/index'));
     $this->display();
 }
 public function index()
 {
     $model = new \Home\Model\MovieModel();
     $result = $model->searchMovie(I('post.word'));
     $allmovie = $model->select('movie');
     $this->assign('allmovie', $allmovie);
     $this->assign('searchurl', U('Search/index'));
     $this->assign('result', $result);
     $this->assign('movieurl', U('Movie/index'));
     $this->display();
 }
 public function index()
 {
     //    $this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover{color:blue;}</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p><br/>版本 V{$Think.version}</div><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_55e75dfae343f5a1"></thinkad><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
     $model = new \Home\Model\MovieModel();
     $data = $model->select('movie');
     $this->assign('allmovie', $data);
     //var_dump($data);
     $this->assign('movieurl', U('Movie/index'));
     //  $this->assign('movieurl',U('Movie/index'));
     // var_dump($data[1]);
     $this->assign('searchurl', U('Search/index'));
     $this->display();
 }
 public function index()
 {
     $id = I('get.cinema_id');
     $model = new \Home\Model\MovieModel();
     $result = $model->selectOne('cinema', 'cinema_id=' . $id);
     //var_dump($result);
     $this->assign('searchurl', U('Search/index'));
     $allMovie = $model->select('movie', '', '0,9');
     $this->assign('cinema', $result[0]);
     $this->assign('allmovie', $allMovie);
     $this->assign('movieurl', U('Movie/index'));
     $this->display();
 }
 public function index()
 {
     $model = new \Home\Model\MovieModel();
     $result = $model->getContentByType('cinema', 3, 'cinema_id');
     //var_dump($result['list'][0]);
     $data = $model->select('movie');
     $this->assign('allmovie', $data);
     $this->assign('movieurl', U('Movie/index'));
     $this->assign('result', $result);
     $this->assign('url', U('Cinema/index'));
     $this->assign('front', U('CinemaList/index?start=' . $result['pageFront']));
     $this->assign('next', U('CinemaList/index?start=' . $result['pageNextStart']));
     $this->assign('searchurl', U('Search/index'));
     $this->display();
 }
 public function select()
 {
     $model = new \Home\Model\MovieModel();
     $where = '';
     include '';
     if (I('get.address')) {
         $where = " address ='" . I('get.address') . "' and ";
     }
     if (I('get.name')) {
         $where = " name ='" . I('get.name') . "' and " . $where;
     }
     $where = $where . ' 1=1 ';
     $limit = I('get.pageInde') * I('get.limit');
     $result = $model->select('cinema', $where, I('get.start') . ',' . $limit);
     $this->selectData($result, 'Cinema');
 }
 public function index()
 {
     $id = I('get.movie_id');
     $model = new \Home\Model\MovieModel();
     $result = $model->selectOne('movie', 'movie_id=' . $id);
     $join = [' join movie on movie.movie_id=schedule.movie_id ', ' join hall on schedule.hall_id=hall.hall_id '];
     $where = ' schedule.movie_id=' . $id . ' ';
     $dom = $model->select('schedule', $where, '', $join);
     foreach ($dom as &$movie) {
         $movie['cinema'] = $model->selectOne('cinema', ' cinema_id=' . $movie['cinema_id']);
         $movie['cinema'] = $movie['cinema'][0];
     }
     // var_dump($dom);
     // $ticketUrl = ;
     $join = ['join hall on hall.hall_id=schedule.hall_id', 'join cinema on hall.cinema_id=cinema.cinema_id'];
     $allSchedule = $model->select('schedule', 'movie_id=' . $id, '', $join);
     $allComments = $model->select('comment', 'movie_id=' . $id, '', ' user on user.user_id=comment.user_id');
     $allMovie = $model->select('movie');
     //var_dump($allSchedule);
     $this->assign('allSchedule', $allSchedule);
     $this->assign('movieurl', U('Movie/index'));
     $this->assign('dom', $dom);
     $this->assign('ticketUrl', U('ticket/index'));
     $this->assign('movie', $result[0]);
     $this->assign('allmovie', $allMovie);
     $this->assign('allComments', $allComments);
     $this->assign('searchurl', U('Search/index'));
     //  var_dump($allComments );
     //$this->assign('allmovie',$allMovie);
     $this->display();
 }
 public function index()
 {
     islogin();
     $this->assign('searchurl', U('Search/index'));
     $model = new \Home\Model\MovieModel();
     $account = M('account');
     $user_id = getUserId();
     //var_dump($user_id);
     $join = ['left join schedule on schedule.schedule_id=account.schedule_id', 'left join movie on movie.movie_id=schedule.movie_id'];
     $userinfo = $model->select('user', 'user_id=' . $user_id);
     $where = 'account.user_id=' . $user_id;
     $filed = 'account_id,user_id,buy_time,schedule.schedule_id,name,schedule.movie_id,date,price';
     $records = $account->join($join)->where($where)->field($filed)->select();
     //var_dump($userinfo);
     $this->assign('records', $records);
     $this->assign('userinfo', $userinfo[0]);
     $this->display();
 }
 /**
  * @return string
  */
 public function select()
 {
     $model = new \Home\Model\MovieModel();
     $where = '';
     include '';
     if (I('get.showtime')) {
         $where = " showtime >='" . I('get.showtime') . "' and ";
     }
     if (I('get.endtime')) {
         $where = " endtime <='" . I('get.endtime') . "' and " . $where;
     }
     if (I('get.name')) {
         $where = " name='" . I('get.name') . "' and " . $where;
     }
     $where = $where . ' 1=1 ';
     $limit = I('get.pageInde') * I('get.limit');
     $result = $model->select('movie', $where, I('get.start') . ',' . $limit);
     $this->selectData($result, 'Movie');
 }
 public function select()
 {
     $model = new \Home\Model\MovieModel();
     $where = '';
     if (I('get.user_id')) {
         $where = " user.user_id ='" . I('get.user_id') . "' and " . $where;
     }
     if (I('get.account_id')) {
         $where = " account_id ='" . I('get.account_id') . "' and " . $where;
     }
     if (I('get.startDate')) {
         $where = " buy_time>='" . I('get.startDate') . "' and " . $where;
     }
     if (I('get.end')) {
         $where = " buy_time<='" . I('get.end') . "' and " . $where;
     }
     $where = $where . ' 1=1 ';
     $limit = I('get.pageInde') * I('get.limit');
     $result = $model->select($this->tableName, $where, I('get.start') . ',' . $limit, ' user on user.user_id=account.user_id');
     $this->selectData($result, $this->util);
 }
 public function buy()
 {
     //  var_dump($_POST);
     //  $lockModel = new \Think\Model(); // 实例化一个model对象 没有对应任何数据表
     $model = new \Home\Model\MovieModel();
     $schedule_id = I('post.schedule_id');
     $tickets = I('post.seats');
     $user_id = getUserId();
     // $account = M('account');
     //$lockModel = M();
     M()->startTrans();
     //$lockModel->lockTable('account',1);
     $seats = $model->select('account', '', '', '', true);
     $tflag = true;
     foreach ($tickets as $ticket) {
         $flag = true;
         foreach ($seats as $seat) {
             if ($seat['col'] == $ticket['col'] && $seat['row'] == $ticket['row']) {
                 $flag = false;
                 break;
             }
         }
         if ($flag) {
             $data = ['buy_time' => date('Y-m-d h-i-s'), 'col' => $ticket['col'], 'row' => $ticket['row'], 'user_id' => $user_id, 'schedule_id' => $schedule_id];
             //var_dump($data);
             $model->addData('account', $data);
         } else {
             M()->rollback();
             echo '{"success":0}';
             $tflag = false;
             break;
         }
     }
     if ($tflag) {
         M()->commit();
         echo '{"success":1}';
         //  echo '{"success":1}';
     }
 }
 public function check()
 {
     //var_dump($_GET);
     $model = new \Home\Model\MovieModel();
     $result = $model->selectOne('user', " email='" . I('get.email') . "' ");
     $result = $result[0];
     if ($result) {
         if ($result['password'] == I('get.password')) {
             $this->setToken($result);
             $this->redirect('Home/Index/index', array('cate_id' => 2), 1, '<script>alert("success")</script>');
         } else {
             $this->redirect('Home/Sign/index', array('cate_id' => 2), 1, '<script>alert("password error")</script>');
         }
     } else {
         $data = ['email' => I('get.email'), 'password' => I('get.password'), 'phone' => '-', 'nickname' => md5(date('Y-m-d h-i-s')), 'headurl' => 'headicon.jpg'];
         $user = M('user');
         $user->add($data);
         $data['user_id'] = $user->getLastInsID();
         $this->setToken($data);
         $this->redirect('Home/Index/index', array('cate_id' => 2), 1, '<script>alert("register success")</script>');
     }
 }
 public function select()
 {
     $model = new \Home\Model\MovieModel();
     $where = '';
     if (I('get.startDate')) {
         $where = " addDate >='" . I('get.startDate') . "' and ";
     }
     if (I('get.endDate')) {
         $where = " addDate <='" . I('get.endDate') . "' and " . $where;
     }
     if (I('get.user_id')) {
         $where = " user.user_id=" . I('get.user_id') . " and " . $where;
     }
     if (I('get.comment_id')) {
         $where = " comment_id=" . I('get.comment_id') . " and " . $where;
     }
     $where = $where . ' 1=1 ';
     $join = ['LEFT JOIN user ON user.user_id=comment.user_id', 'LEFT JOIN movie ON movie.movie_id=comment.movie_id'];
     $limit = I('get.pageInde') * I('get.limit');
     $result = $model->select('comment', $where, I('get.start') . ',' . $limit, $join);
     //var_dump($result);
     $this->selectData($result, 'Discuss');
 }