75 lines
2.4 KiB
C#
75 lines
2.4 KiB
C#
using Assets.Scripts.Apis.Models;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace Assets.Scripts.Apis
|
||
{
|
||
public class MapApi :ApiBase
|
||
{
|
||
public string GetMapToken(string name)
|
||
{
|
||
return Get($"Map/GetMapToken?name={name}");
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取路线数据
|
||
/// </summary>
|
||
/// <param name="url"></param>
|
||
/// <returns></returns>
|
||
public MapDataModel GetData(int id)
|
||
{
|
||
return Newtonsoft.Json.JsonConvert.DeserializeObject<MapDataModel>(Get("Map/GetData?routeId="+id));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 从服务端获取记录信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<MapRecordRanking> GetRecordFileFromServer(List<string> id)
|
||
{
|
||
return Post<JsonResult<List<MapRecordRanking>>>("Map/GetCyclingRecordsById", id).data;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 通过Id获取路书
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
public JsonResult<MapRoute> GetById(int id)
|
||
{
|
||
return Get<JsonResult<MapRoute>>($"Map/GetMapRouteById?id={id}");
|
||
}
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="pageIndex"></param>
|
||
/// <param name="pageSize"></param>
|
||
/// <param name="name">名称,地址,编号</param>
|
||
/// <param name="distance">距离,格式0-10</param>
|
||
/// <param name="is3D"></param>
|
||
/// <param name="sort">hot, distance</param>
|
||
/// <param name="sortDire">asc</param>
|
||
/// <returns></returns>
|
||
public JsonResult<List<MapRoute>> GetList(int pageIndex, int pageSize, string name, string distance="", string hands="", bool is3D=false, string sort="", string sortDire = "")
|
||
{
|
||
var url = $"Map/GetRoute?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&distance={ distance }&hands={ hands }&is3D={ is3D }&sort={ sort }&sortDire={ sortDire }";
|
||
|
||
return Get<JsonResult<List<MapRoute>>>(url);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 从服务端获取Key
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public Dictionary<string, string> GetServiceKeyFromServer()
|
||
{
|
||
return Get<JsonResult<Dictionary<string, string>>>($"Map/GetServiceKey").data;
|
||
}
|
||
|
||
}
|
||
}
|