<?php

require('path.inc.php');

if($page->action == 'point'){
	//保存小区的地图信息
	$borough = new Borough($query);
	$point = $_POST["point"];
	$id = intval($_POST['id']);
	if (!$point) {
		echo 0;
		exit;
	}
	if($borough->updateMap($id,$point)){
		echo 1;
	}else{
		echo 0;	
	}
	
}elseif($page->action == 'getBoroughList'){
	$borough = new Borough($query);
	$_GET["q"] = charsetIconv($_GET["q"]);
	$q = strtolower($_GET["q"]);
	if (!$q) return;
	$datalist = $borough->getAll('*'," (borough_name like '%".$q."%' or borough_letter like '%".$q."%' or borough_alias like '%".$q."%' or borough_address like '%".$q."%') and isdel <>1  and borough_evaluate<>'' ");
	foreach ($datalist as $key=>$value) {
		if($value['borough_alias']){
			$str .= $value['borough_name']."|".$value['id']."|".$value['borough_address']."\n";
		}else{
			$str .= $value['borough_name']."|".$value['id']."|".$value['borough_address']."\n";
		}
	}

	//$str .= "我要创建新小区|addBorough|addBorough\n";
	echo $str;
}
?>