public ActionResult AddShop(string keyValue, POS_ShopEntity entity) { //微信火星转百度 double Lon = double.Parse(entity.wxLon); double Lat = double.Parse(entity.wxLat); double bdLat, bdLon; MapConverter.GCJ02ToBD09(Lat, Lon, out bdLat, out bdLon); entity.bdLat = bdLat.ToString(); entity.bdLon = bdLon.ToString(); entity.OpenId = CurrentWxUser.OpenId; entity.NickName = CurrentWxUser.NickName; //根据坐标获取省市县信息 string url = @"http://restapi.amap.com/v3/geocode/regeo?location=" + Lon + "," + Lat + "&key=cf3dd05a8192fd1839628b39e589c89e&radius=1000&extensions=all";//output=XML& string responseJson = HttpClientHelper.Get(url); RestLocation restLocation = JsonConvert.DeserializeObject <RestLocation>(responseJson.Replace("[]", "\"\"")); entity.Province = restLocation.regeocode.addressComponent.province; entity.City = restLocation.regeocode.addressComponent.city; entity.CityCode = restLocation.regeocode.addressComponent.citycode; entity.District = restLocation.regeocode.addressComponent.district; //插入店铺表 posShopBll.SaveForm(keyValue, entity); return(Content("true")); }
/// <summary> /// Gets all parameters for specific location. /// </summary> public List <PSParameter> GetParametersByLocation(RestLocation location, bool includeHidden = false) { return(Parameters.Where(x => x.Location == location && (includeHidden || !x.Hidden)) .OrderBy(x => x.Position) .ToList()); }