Commit 5b119abf authored by 吴春's avatar 吴春

提交代码,根据地址名称获取经纬度

parent 31d20edf
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Common.Plugin;
......@@ -426,6 +427,29 @@ namespace Mall.WebApi.Controllers.Product
});
}
/// <summary>
/// 根据地址获取经纬度
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[HttpPost]
public ApiResult GetLngAndLat(object requestMsg)
{
var req = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
JObject prams = JObject.Parse(req.msg.ToString());
string address = prams.GetStringValue("Address");
var array = Common.Plugin.HttpHelper.GetGeocoderLatitude(address);
if (array[0] != "" && array[1] != "")
{
return ApiResult.Success("", new { lng = array[0], lat = array[1] });
}
else
{
return ApiResult.Failed("获取地址错误");
}
}
#endregion
#region 订单信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment