/** * 返回国家列表 * @access public */ function index() { $category_1 = get_post_value('category_1'); $category_2 = get_post_value('category_2'); $category_3 = get_post_value('category_3'); $field = array('category_2.category_1_id', 'category_2.category_2_id', 'category_2.category_2_cn', 'category_2.category_2_th', 'category_3.category_3_id', 'category_3.category_3_cn', 'category_3.category_3_th', 'category_3.orders', 'category_3.status', 'category_3.created', 'category_3.created_name', 'category_3.audit_name', 'category_3.start_time', 'category_3.end_time'); $m = new Category(); $m->clear(); $m->setField($field); $m->setTable('vcb_product_category_3 AS category_3'); $m->setJoin('vcb_product_category_2 as category_2', 'category_2.category_2_id=category_3.category_2_id'); $m->setWhere('category_3.status', '!=', '60000'); if ($category_1 != '') { $m->setWhere('category_3.category_1_id', '=', $category_1); } if ($category_2 != '') { $m->setWhere('category_3.category_2_id', '=', $category_2); } if ($category_2 != '') { $m->setWhere('category_3.category_3_cn', 'LIKE', '%' . $category_3 . '%', 'AND', '('); $m->setWhere('category_3.category_3_th', 'LIKE', '%' . $category_3 . '%', 'OR', ')'); } $m->setOrderBy(array('category_2.orders' => 'ASC', 'category_3.orders' => 'ASC')); $count = $m->getRowsCount(); $page = new Page($count); $parameter = array('category_1' => $category_1, 'category_2' => $category_2, 'category_3' => $category_3); $page->setParameter($parameter); $showPage = $page->showPage(); $showTotal = $page->showTotal(); $m->setPage(); $data = $m->select(); //状态标题 $count = count($data); for ($i = 0; $i < $count; $i++) { $status = $data[$i]['status']; $data[$i]['status_cn'] = $m->getStatus('cn', $status); $data[$i]['status_th'] = $m->getStatus('th', $status); $data[$i]['category_1'] = $m->getCategory_1($data[$i]['category_1_id']); } $this->assign('data', $data); $this->assign('showPage', $showPage); //输出分页 $this->assign('showTotal', $showTotal); //输出分页合计 if ($category_1 != '') { $c_2 = $m->getCategory_2($category_1); $this->assign('category_2', $c_2); } else { $this->assign('category_2', array()); } }