powerfun-new-net/Api/WebService.cs
andy 0e931a3ac9 一些功能调整
增加tcp协议支持;
增加模拟多用户的功能;
2021-01-18 20:24:19 +08:00

39 lines
1.2 KiB
C#

using Newtonsoft.Json;
using OnlineUserPool.Model;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace OnlineUserPool.Api
{
public class WebService : BaseApi
{
/// <summary>
/// 从服务端获取记录信息
/// </summary>
/// <returns></returns>
public static List<MapRecordRanking> GetRecordFileFromServer(List<long> id)
{
if (!id.Any())
{
return new List<MapRecordRanking>();
}
return PostAsync<JsonResult<List<MapRecordRanking>>>("MapRecord/GetRandomList", id).ConfigureAwait(false).GetAwaiter().GetResult().data;
}
public static List<MapRouteAndUserQueryVM> GetMapRouteRandomRecord(int top, IEnumerable<int> routeIds)
{
var routeIdsStr = "";
if(routeIds != null)
{
routeIdsStr = string.Join(",", routeIds);
}
return GetAsync<JsonResult<List<MapRouteAndUserQueryVM>>>($"MapRecord/GetRandomRankingUserRecord?top={ top }&routeIds={ routeIdsStr }").ConfigureAwait(false).GetAwaiter().GetResult().data;
}
}
}