56 lines
2.0 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 RowerApi : ApiBase
{
/// <summary>
/// 上传划船记录到服务端
/// </summary>
/// <param name="interruptRecord"></param>
public JsonResult<object> Add(RowerRecordModel record, List<string> fileNames)
{
var result = Upload("Rower/AddRecord", record, fileNames);
var jsonResult = JsonConvert.DeserializeObject<JsonResult<object>>(result);
return jsonResult;
}
public async Task<JsonResult<List<JObject>>> GetList(int pageIndex, int pageSize)
{
return await GetAsync<JsonResult<List<JObject>>>($"Rower/GetList?pageIndex={pageIndex}&pageSize={pageSize}");
}
public async Task<JsonResult<RowerResultModel>> GetDetail(string id)
{
return await GetAsync<JsonResult<RowerResultModel>>($"Rower/GetDetail?Id={id}");
}
public async Task<JsonResult<RowerSegmentData>> GetSegmentDataAndRanking(string id)
{
return await GetAsync<JsonResult<RowerSegmentData>>($"Rower/GetSegmentDataAndRanking?Id={id}");
}
public async Task<JsonResult<object>> Delete(string Id)
{
return await PostAsync<JsonResult<object>>($"Rower/Delete",new { Id});
}
public async Task<JsonResult<List<RowerRank>>> GetShadowList(RowerTaskPanel.RowerType rowerType)
{
return await GetAsync<JsonResult<List<RowerRank>>>($"Rower/GetShadowList?type={rowerType.type}&typeValue={rowerType.value}");
}
public async Task<JsonResult<List<RowerRank>>> GetReRowShadowList(string id)
{
return await GetAsync<JsonResult<List<RowerRank>>>($"Rower/GetReRowShadowList?Id={id}");
}
}
}