public function Category()
 {
     $cat_model = new \Model\CategoryModel();
     $goods_model = new \Model\GoodsModel();
     //精品推荐
     $this->goods_best_list = $goods_model->getGoodsByType('best', 3);
     //判断栏目是否是顶级栏目,是就查出该栏目下所有子栏目的商品
     $cat_id = $_GET['cat_id'] + 0;
     $ids = $cat_model->getChild($cat_id);
     if (empty($ids)) {
         //代表自身是子栏目,将自身加入到数组中
         $ids[] = $cat_id;
     }
     $ids = implode(',', $ids);
     //总记录数
     $count = $goods_model->where("cat_id in ({$ids})")->count();
     $pagesize = 2;
     //总页数
     $pagecount = ceil($count / $pagesize);
     //获取页码
     $pageno = isset($_GET['pageno']) ? $_GET['pageno'] : 1;
     if ($pageno < 1) {
         $pageno = 1;
     }
     if ($pageno > $pagecount) {
         $pageno = $pagecount;
     }
     $goods_cat_list = $goods_model->field('goods_id,goods_name,shop_price,goods_thumb')->where("cat_id in ({$ids})")->page($pageno, $pagesize)->select();
     if (isset($_GET['pageno'])) {
         $this->ajaxReturn($goods_cat_list);
         exit;
     } else {
         $this->assign('goods_cat_list', $goods_cat_list);
         $this->assign('pagecount', $pagecount);
         $this->assign('pageno', $pageno);
         $this->assign('cat_id', $cat_id);
         $this->display();
     }
 }