1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * 前台控制器
- * 书籍分类
- */
- namespace app\index\controller;
- use app\common\controller\Frontend;
- use app\common\model\Config;
- class Category extends Frontend
- {
- protected $layout = '';
- protected $categories_extime; //类别页面数据过期时间 默认7天
- protected $categorybooklist_extime; //类别下书籍列表过期时间 默认1天
- public function _initialize()
- {
- parent::_initialize();
- $this->categories_extime = 86400 * 7;
- $this->categorybooklist_extime = 86400;
- $this->view->assign('adminconfig',$this->adminconfig);
- }
- /**
- * 分类页
- */
- public function index()
- {
- $sex = input('sex');
- if(empty($sex)){
- $sex = 1;
- }
- $this->view->assign('sex',$sex);
- return $this->view->fetch();
- }
- /**
- * 分类书籍页
- * @param int $book_category_id
- * @return array
- */
- public function books()
- {
- $book_category_id = input('book_category_id');
- $category = model('BookCategory')->info($book_category_id);
- $this->assign('category', $category);
- return $this->view->fetch();
- }
- }
|