2021-04-26 16:25:52 +08:00
|
|
|
|
using Assets.Scripts.Apis.Models;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2021-04-06 15:30:36 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2021-06-08 11:32:06 +08:00
|
|
|
|
using System.Globalization;
|
2021-04-26 16:25:52 +08:00
|
|
|
|
using System.IO;
|
2021-04-06 15:30:36 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Assets.Scripts.Apis
|
|
|
|
|
|
{
|
|
|
|
|
|
public class ThirdPartApi : ApiBase
|
|
|
|
|
|
{
|
2021-04-26 16:25:52 +08:00
|
|
|
|
public async Task<IpToGeoModel> GetLocationInfo()
|
|
|
|
|
|
{
|
|
|
|
|
|
return await GetThirdPartAsync<IpToGeoModel>("https://ip.seeip.org/geoip");
|
|
|
|
|
|
//return await GetThirdPartAsync<LocationModel>($"http://api.map.baidu.com/location/ip?ak=NsfCV0Sp5r0O8yY49RPIpOQZkWFlDnmi&coor=gcj02");
|
|
|
|
|
|
}
|
|
|
|
|
|
public async Task<Stream> GetMapImage(IpToGeoModel locationInfo)
|
|
|
|
|
|
{
|
2021-06-08 11:32:06 +08:00
|
|
|
|
return await GetThirdPartStreamAsync($"https://api.mapbox.com/styles/v1/juzetest/ckmkdjwsa1nvt17nr1ps4fqgs/static/{locationInfo.longitude.ToString(CultureInfo.InvariantCulture)},{locationInfo.latitude.ToString(CultureInfo.InvariantCulture)},12,0/1280x1280?access_token=pk.eyJ1IjoianV6ZXRlc3QiLCJhIjoiY2ttazhsbnpiMGVrdjJucGhyNnh6eXcxYSJ9.6zj2U9eFCNJRMljNlMxjVg");
|
2021-04-28 18:41:54 +08:00
|
|
|
|
//pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA
|
|
|
|
|
|
//pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA
|
2021-04-26 16:25:52 +08:00
|
|
|
|
}
|
2021-04-06 15:30:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|