public function indexAction() { $userInfo = $this->session->get('userInfo'); //验证会员是否已登录 if (empty($userInfo)) { $url = $this->url->get('user/login'); header("Location:{$url}"); exit; } $uid = $userInfo['id']; //分页 $page = $this->request->get('page') ? $this->request->get('page') : 1; $filter = array("uid={$uid}", 'order' => 'ctime desc'); //总数 $count = \Order::count($filter); $limit = 5; $filter['offset'] = ($page - 1) * $limit; $filter['limit'] = $limit; //查询订单信息 $userOrder = \Order::find($filter) ? \Order::find($filter)->toArray() : ''; //查询订单影片信息 foreach ($userOrder as &$val) { $val['film'] = Film::findFirst('id=' . $val['film_id'])->toArray(); $val['film_heat'] = FilmHeat::findFirst('film_id=' . $val['film_id'])->toArray(); $schedule = FilmSchedule::findFirst('id=' . $val['schedule_id'])->toArray(); if ($schedule) { $time = strtotime($schedule['starttime']); $week_arr = array('日', '一', '二', '三', '四', '五', '六'); $val['film_schedule'] = date('n', $time) . '月' . date('j', $time) . '日 周' . $week_arr[date('w', $time)] . ' ' . date('H:i', $time); } else { $val['film_schedule'] = ''; } } $page_html = \ToolStr::GetPage($count, $limit); $this->view->setVar('page_html', $page_html); $this->view->setVar('userInfo', $userInfo); $this->view->setVar('user_order', $userOrder); $this->view->setVar('title', '会员中心'); }