<?php
/** 
 * UQ云商：	www.uqcms.com  
 * 联系QQ：	2200631718 
 * 可免费商用，需要留UQ云商链接作为交换，只首页底部留取即可，不影响使用。
 */

defined('IN_UQ') or exit('Access Denied'); class area_mod extends module { function get_list() { $uq0 = cache::get("config/area"); if(!$uq0){ $uq1 = $this->db->get_all("select id,pid,name from ".table('area')." order by id asc"); if($uq1){ foreach($uq1 as $uq2=>$uq3){ if($uq3['pid'] == '0'){ $uq4[$uq3['id']] = $uq3['name']; $uq5[] = $uq3; } } foreach($uq5 as $uq2=>$uq3){ foreach($uq1 as $uq6=>$uq7){ if($uq3['id'] == $uq7['pid']){ $uq8[$uq3['id']][$uq7['id']] = $uq7['name']; $uq9[$uq3['id']][] = $uq7; $uq10[] = $uq7; } } } foreach($uq10 as $uq2=>$uq3){ foreach($uq1 as $uq6=>$uq7){ if($uq3['id'] == $uq7['pid']){ $uq11[$uq3['id']][$uq7['id']] = $uq7['name']; $uq12[$uq3['id']][] = $uq7; } } } $uq13['prov'] = $uq4; $uq13['city'] = $uq8; $uq13['dist'] = $uq11; cache::add("config/area", $uq13); return $uq13; }else{ return false; } }else{ return $uq0; } } public function edit_district($uq5 = NULL,$uq9 = NULL) { if(empty($uq5) && empty($uq9)){ $uq1 = $this->db->get_all("select * from ".table('district')." where pid  = 0"); foreach($uq1 as $uq2=>$uq3){ $uq14[$uq3['pid']][] = $uq3; } $uq15['prov'] = $uq14[0]; }else{ $uq1 = $this->db->get_all("select * from ".table('district')." where pid in (0,".$uq5.",".$uq9.")"); foreach($uq1 as $uq2=>$uq3){ $uq14[$uq3['pid']][] = $uq3; } $uq15['prov'] = $uq14[0]; $uq15['city'] = $uq14[$uq5]; $uq15['dist'] = $uq14[$uq9]; } return $uq15; } function get_city() { for($uq16=65; $uq16<91; $uq16++){ $uq17 = chr($uq16); $uq18['name'] = $uq17; $uq19 = $this->db->query("select * from ".table('area')." where level = 2 and letter = '".$uq17."'"); while($uq20 = $this->db->fetch_array($uq19)){ $uq18['parent'][] = $uq20; } if(count($uq18['parent']) != '0'){ $uq15[] = $uq18; } unset($uq18['parent']); } return $uq15; } public function letter() { for($uq16=65;$uq16<91;$uq16++){ $uq15[] = chr($uq16); } return $uq15; } public function get_cn($uq21) { $uq5 = isset($uq21['prov'])?$uq21['prov']:'0'; $uq9 = isset($uq21['city'])?$uq21['city']:'0'; $uq12 = isset($uq21['dist'])?$uq21['dist']:'0'; $uq22 = $this->db->get_all("select * from ".table('area')." where id in(".$uq5.",".$uq9.",".$uq12.") order by id asc; "); if($uq22){ $uq15['prov'] = $uq22[0]['id']; $uq15['prov_cn'] = $uq22[0]['name']; $uq15['city'] = $uq22[1]['id']; $uq15['city_cn'] = $uq22[1]['name']; $uq15['dist'] = $uq22[2]['id']; $uq15['dist_cn'] = $uq22[2]['name']; return $uq15; } } } 