示例#1
0
 /**
  * 分区信息
  *
  * @return $this
  */
 public function getList()
 {
     try {
         $tid = Input::get('tid', 0);
         $page = Input::get('page', 1);
         $order = Input::get('order', 'hot');
         $bili_util = new BiliUtil();
         if ($page == 1) {
             $cache_name = GlobalVar::$LIST_CACHE . $tid;
             if (!Cache::has($cache_name)) {
                 $back_json = $bili_util->getPageList($tid, $order, 1, GlobalVar::$PAGE_SIZE);
                 Cache::add($cache_name, $back_json, 60 * 60 * 2);
             } else {
                 $back_json = Cache::get($cache_name);
             }
         } else {
             $back_json = $bili_util->getPageList($tid, $order, $page, GlobalVar::$PAGE_SIZE);
         }
         $paginator = new Paginator($back_json['list'], $page);
         $paginator->setPath('/list');
         $sorts = CacheSetter::getSort();
         $hot = CacheSetter::getHot();
         return view('pusher.list')->with('sorts', $sorts)->with('list', $back_json['list'])->with("paginator", $paginator)->with('tid', $tid)->with('hots', $hot);
     } catch (Exception $e) {
         return view('pusher.error')->with('error_content', $e->getMessage());
     }
 }