forked from powerfun/udpservice
73 lines
2.4 KiB
C#
73 lines
2.4 KiB
C#
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
|
|
{
|
|
/// <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;
|
|
}
|
|
|
|
public static List<RoomModel> GetGameRoomList(int pageIndex,int pageSize)
|
|
{
|
|
return GetAsync<JsonResult<List<RoomModel>>>($"GameRoom/GetList?pageIndex={ pageIndex }&pageSize={ pageSize }").ConfigureAwait(false).GetAwaiter().GetResult().data;
|
|
}
|
|
|
|
public static void DeleteGameRoom(int id)
|
|
{
|
|
var result = PostAsync<JsonResult>($"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<JsonResult>($"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<JsonResult>($"Admin/GameRoom/Update", new
|
|
{
|
|
roomId,
|
|
status
|
|
}).ConfigureAwait(false);
|
|
}
|
|
}
|
|
}
|