/** * 获取分类下的子分类 */ public function get_sub_category($pid) { $categories = $this->get_category_tree(); $sub_tree = get_node_children($categories, $pid); return $sub_tree; }
/** * 生成某个栏目列表 */ public function build_single_list($v = array()) { $data = $this->input->stream(); if (isset($data['v'])) { $v = $data['v']; } $page = isset($data['page']) ? $data['page'] : 1; $temp = explode('/', $v['source_rule']); if (sizeof($temp) == 5) { empty($temp[0]) && array_shift($temp); // $arr_columns = $this->mycategory->set_model('column_model')->get_sub_category($v['id']); // $str_cid = implode(',', $arr_columns); if ($page == 1) { $ids = get_node_children($this->columns, $v['id']); $str_cid = implode(',', $ids); $record_count = $this->db->where("cid in ({$str_cid})")->get('archives')->num_rows(); $page_count = ceil($record_count / $temp[4]); $page_count == 0 && ($page_count = 1); } else { $page_count = $data['page_count']; } if ($page <= $page_count) { $temp = $v; $temp['destination_rule'] = str_replace('page', $page, $temp['destination_rule']); $temp['source_rule'] = str_replace('page', $page, $temp['source_rule']); $this->build($temp); if ($page == 1) { $path_info = explode('/', $temp['destination_rule']); $temp['destination_rule'] = '/' . $path_info[0] . '/index.html'; $temp['source_rule'] = str_replace('page', $page, $temp['source_rule']); $this->build($temp); } die(json_encode(array('code' => 202, 'message' => "正在生成第 {$page} 批列表页 <br />", 'data' => array('url' => '/Backend/build_html/build_single_list', 'data' => array('v' => $v, 'page' => ++$page, 'page_count' => $page_count))))); } else { die(json_encode(array('code' => 200, 'message' => "生成成功<br />", 'data' => array('v' => $v)))); } } }