getTopLevelAreas(); foreach ($lev1 as $k => $v) { $lev3 = $lev2[$k]['area_id'] = $area_model->GetChildName($k); foreach ($lev3 as $val) { $lev4[$k]['area_name'] = $v; $lev4[$k]['area_id'] = $k; $lev4[$k]['child'][$val['area_id']]['area_name'] = $val['area_name']; $lev4[$k]['child'][$val['area_id']]['area_id'] = $val['area_id']; $lev4[$k]['child'][$val['area_id']]['child'] = $area_model->GetChildName($val['area_id']); } } $area_list = array(); foreach ($lev4 as $key => $val) { $val['child'] = array_values($val['child']); $area_list[] = $val; } wcache($cache_key, $area_list); } ds_json_encode(10000, '', array('area_list' => $area_list)); } public function area_list() { $areas = model('area')->getAreas(); ds_json_encode(10000, '', array('area_list' => $areas)); } }