public function index() { $perpage = 10; $page = intval(I("get." . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) ? intval(I('get.' . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) : 1; $limit = ($page - 1) * $perpage . "," . $perpage; if ($_GET) { $where = array(); $IndustryInformations = $this->_Model->IndustryInformation_lists($where, $limit); $total = $this->_Model->IndustryInformation_count($where); } else { // 获取当前买家资讯 $IndustryInformations = $this->_Model->IndustryInformation_lists($where, $limit); $total = $this->_Model->IndustryInformation_count($where); } $page_num = ceil($total / $perpage); $pageobj = new Page1($total, $perpage); $pageobj->setConfig('prev', '<<'); $pageobj->setConfig('next', '>>'); $pageshow = $pageobj->show(); $this->assign("pageshow", $pageshow); $this->assign('page_num', $page_num); $this->assign('total', $total); $this->assign("IndustryInformations", $IndustryInformations); $this->display(); }
public function goods_list() { $perpage = 20; $page = intval(I("get." . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) ? intval(I('get.' . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) : 1; $limit = ($page - 1) * $perpage . "," . $perpage; if ($_GET) { $s_province = I('get.s_province', ''); $s_city = I('get.s_city', ''); $cate1_id = intval(I('get.cate1_id', 0)); $stock_start = intval(I('get.stock_start', 0)); $stock_end = intval(I('get.stock_end', 0)); $price_start = floatval(I('get.price_start', 0)); $price_end = floatval(I('get.price_end', 0)); if ($cate1_id > 0) { $where['cate1_id'] = $cate1_id; } if ($s_province != '省份') { $where['cht_goods_address.province'] = $s_province; } if ($s_city != '地级市') { $where['cht_goods_address.city'] = $s_city; } // 库存查询 if ($stock_start > 0 && $stock_end > 0) { $where['stock'] = array('between', array($stock_start, $stock_end)); } elseif ($stock_start > 0) { $where['stock'] = array('egt', $stock_start); } elseif ($stock_end > 0) { $where['stock'] = array('elt', $stock_end); } // 价格查询 if ($price_start > 0.0 && $price_end > 0.0) { $where['price'] = array('between', array($price_start, $price_end)); } elseif ($price_start > 0.0) { $where['price'] = array('egt', $price_start); } elseif ($price_end > 0.0) { $where['price'] = array('elt', $price_end); } $where['is_show'] = 1; $goods = $this->_Model->goods_lists($where, $limit); $total = $this->_Model->goods_count($where); } else { // 获取全部商品 $where = array('is_show' => 1); $goods = $this->_Model->goods_lists($where, $limit); $total = $this->_Model->goods_count($where); } $page_num = ceil($total / $perpage); $pageobj = new Page1($total, $perpage); $pageobj->setConfig('prev', '<<'); $pageobj->setConfig('next', '>>'); $pageshow = $pageobj->show(); $cate1 = D("GoodsCategory")->cate1_list(); $this->assign('page_num', $page_num); $this->assign('total', $total); $this->assign('cate1', $cate1); $this->assign("pageshow", $pageshow); $this->assign("goods", $goods); $this->display(); }