2022-05-13 09:28:58 +08:00

47 lines
1.4 KiB
C#

using Assets.Scripts.Apis.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Apis
{
public class GameRoomApi : ApiBase
{
public async Task<JsonResult<object>> Add(string name,int routeId,string pwd,DateTime startTime,int closeTime,int maxMembers)
{
return await PostAsync<JsonResult<object>>($"GameRoom/Add", new {
name,
routeId,
pwd,
startTime,
closeTime,
maxMembers
});
}
public async Task<JsonResult<GameRoomResult>> GetList(int pageIndex, int pageSize,string name = "")
{
return await GetAsync<JsonResult<GameRoomResult>>($"GameRoom/GetList?pageIndex={pageIndex}&pageSize={pageSize}&name={name}");
}
public JsonResult<GameRoomModel> GetDetail(int id)
{
return Get<JsonResult<GameRoomModel>>($"GameRoom/GetDetail?Id={id}");
}
public async Task<JsonResult<JObject>> ConfirmRoomPwd(int id,string pwd)
{
return await GetAsync<JsonResult<JObject>>($"GameRoom/ConfirmRoomPwd?id={id}&pwd={pwd}");
}
public JsonResult<string> GetMapVideoURL(int routeId)
{
return Get<JsonResult<string>>($"Map/GetMapVideoURL?id={routeId}");
}
}
}