using Newtonsoft.Json;
using OnlineUserPool.Model;
using System;
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
{
///
/// 从服务端获取记录信息
///
///
public static List GetRecordFileFromServer(List id)
{
if (!id.Any())
{
return new List();
}
return PostAsync>>("MapRecord/GetRandomList", id).ConfigureAwait(false).GetAwaiter().GetResult().data;
}
public static List GetMapRouteRandomRecord(int top, IEnumerable routeIds)
{
var routeIdsStr = "";
if(routeIds != null)
{
routeIdsStr = string.Join(",", routeIds);
}
return GetAsync>>($"MapRecord/GetRandomRankingUserRecord?top={ top }&routeIds={ routeIdsStr }").ConfigureAwait(false).GetAwaiter().GetResult().data;
}
public static List GetGameRoomList(int pageIndex,int pageSize)
{
return GetAsync>>($"GameRoom/GetList?pageIndex={ pageIndex }&pageSize={ pageSize }").ConfigureAwait(false).GetAwaiter().GetResult().data;
}
public static void DeleteGameRoom(int id)
{
var result = PostAsync($"GameRoom/Delete", new {id}).ConfigureAwait(false);
}
public static void AddGameRoom(int roomId, int status,int userId,string name, int routeId, string pwd, DateTime startTime, int closeTime, int maxMembers)
{
var result = PostAsync($"Admin/GameRoom/Add", new {
status,
roomId,
userId,
name,
routeId,
pwd,
startTime,
closeTime,
maxMembers
}).ConfigureAwait(false);
}
public static void UpdateGameRoom(int roomId, int status)
{
var result = PostAsync($"Admin/GameRoom/Update", new
{
roomId,
status
}).ConfigureAwait(false);
}
}
}