<?
// 社会用户注册1【非机构】
require_once ("../user_include.inc");

ErrorLogger::doOutput("Compass...ajax_social_user_register1.php....Start.", 0);

$longitude = "121.54409";//用户位置的经度
$latitude = "31.22114";//用户位置的纬度

//调用腾讯LGS服务解析用户地址信息
$tmpUrl = '/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . LBS_SECRET;
$md5Str = md5($tmpUrl);
$lbsUrl = 'https://apis.map.qq.com/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . '&sig=' . $md5Str;
$lbsObj =  file_get_contents($lbsUrl);
$jsonObj = json_decode($lbsObj); //对JSON格式的字符串进行编码
$lbsArray = get_object_vars($jsonObj);//转换成数组
$resultObj = $lbsArray['result'];

$userMst = new UserMst();

if($lbsArray['status'] == "0" && $resultObj->ad_info->nation_code==156) {
	$userMst->province = $resultObj->address_component->province;
	$userMst->city = $resultObj->address_component->city;
	$userMst->district = $resultObj->address_component->district;
}
print_r($userMst);



?>