完成比赛相关接口&历史代码整合

This commit is contained in:
lishuo committed 2021-06-24 18:19:28 +08:00
1 parent 58ec860669
commit 380e67cc1e
24 files changed
+1320 -608

No files matched your search

+81
View File
@@ -0,0 +1,81 @@
using Assets.Scripts.Apis.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Apis
{
internal class MapCompetitionApi : ApiBase
{
/// <summary>
/// 比赛实体
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public JsonResult<MapCompetition> GetById(int id)
{
return Get<JsonResult<MapCompetition>>("/MapCompetition/GetDetail?id=" + id);
}
/// <summary>
/// 获取当前比赛排名
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public JsonResult<List<CompetitionRankingResultModel>> GetRankingList(int id)
{
var list = Get<JsonResult<dynamic>>($"/MapRecord/GetCompetitionRanking?id={ id }&pageIndex=0&pageSize=999");
return new JsonResult<List<CompetitionRankingResultModel>>
{
result = list.result,
errMsg = list.errMsg,
data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<CompetitionRankingResultModel>>(JsonConvert.SerializeObject(list.data.list))
};
}
//查询我参与的比赛列表
public JsonResult<List<JoinedCompetitionModel>> GetMyCompetitionList(string name)
{
var list = Get<JsonResult<dynamic>>($"/MapCompetition/GetMyList?name={ name }");
return new JsonResult<List<JoinedCompetitionModel>>
{
result = list.result,
errMsg = list.errMsg,
data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JoinedCompetitionModel>>(JsonConvert.SerializeObject(list.data))
};
}
//查询比赛列表
public JsonResult<List<MapCompetitionModel>> GetCompetitionList(string name,int pageIndex,int pageSize,int status=0)
{
var list = Get<JsonResult<dynamic>>($"/MapCompetition/v1/GetList?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&status={ status }");
return new JsonResult<List<MapCompetitionModel>>
{
result = list.result,
errMsg = list.errMsg,
data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MapCompetitionModel>>(JsonConvert.SerializeObject(list.data))
};
}
//查询比赛详情
public JsonResult<MapCompetitionDetailModel> GetCompetitionDetail(int id)
{
var list = Get<JsonResult<dynamic>>($"/MapRouteGlobalCycling/Get?id={ id }");
return new JsonResult<MapCompetitionDetailModel>
{
result = list.result,
errMsg = list.errMsg,
data = Newtonsoft.Json.JsonConvert.DeserializeObject<MapCompetitionDetailModel>(JsonConvert.SerializeObject(list.data))
};
}
//报名必比赛
public JsonResult ApplyMapCompetition(int id)
{
return Get<JsonResult>($"/MapCompetition/ApplyMapCompetition?id={ id }");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 89998d6971cbc68409034294cec3169c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,34 @@
namespace Assets.Scripts.Apis.Models
{
/// <summary>
/// 比赛排名的model
/// </summary>
public class CompetitionRankingResultModel
{
public int Index { get; set; }
public int Id { get; set; }
public int RouteId { get; set; }
public double? AveragePower { get; set; }
public double? NormalizedPower { get; set; }
public string CreateTime { get; set; }
public int UserId { get; set; }
public double? AverageCadence { get; set; }
public int? MaxHeartRate { get; set; }
public int TotalTicks { get; set; }
//public string TotalTime { get; set; }
public string TripTime { get; set; }
public double Weight { get; set; }
public double WeightKg { get; set; }
public double TripDistance { get; set; }
public double TotalDistance { get; set; }
public int? AverageHeartRate { get; set; }
public double BicycleWeight { get; set; }
public string NickName { get; set; }
public string Country { get; set; }
public string DeviceType { get; set; }
public string CompleteTime { get; set; }
public string Gap { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ba260963a0eda9848b585c258a1befc9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Apis.Models
{
public class JoinedCompetitionModel
{
public int Id { get; set; }
public string Title { get; set; }
public string Dec { get; set; }
public int CreateUser { get; set; }
public DateTime CreateTime { get; set; }
public bool IsOfficial { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public string CoverImage { get; set; }
public string Area { get; set; }
public int MapCompetitionType { get; set; }
public int Status { get; set; }
public string StatusStr { get; set; }
public object Sponsor { get; set; }
public int RouteId { get; set; }
public DateTime StartApplyTime { get; set; }
public DateTime EndApplyTime { get; set; }
public int MaxMembers { get; set; }
public int CloseTime { get; set; }
public string InviteCode { get; set; }
public string PhoneNumber { get; set; }
public DateTime? FirstEndTime { get; set; }
public bool IsComplete { get; set; }
public double TotalClimb { get; set; }
public double Distance { get; set; }
public double AverageGrade { get; set; }
public double EleDifference { get; set; }
public double MaxElevation { get; set; }
public string Hard { get; set; }
public bool CanEnter { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a288d7af8a840f24589a9bcf63a445ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,55 @@
using System;
namespace Assets.Scripts.Apis.Models
{
public class MapCompetition
{
public int Id { get; set; }
public string Area { get; set; }
public string CompetitionType { get; set; }
public string CoverImage { get; set; }
public string CreateTime { get; set; }
public int CreateUser { get; set; }
public string Dec { get; set; }
public string EndApplyTime { get; set; }
public string EndApplyTimeVlaue { get; set; }
public bool IsOfficial { get; set; }
public int MapCompetitionType { get; set; }
public object NickName { get; set; }
public int pageCount { get; set; }
public int RouteId { get; set; }
public string Sponsor { get; set; }
public string StartApplyTime { get; set; }
public string StartApplyTimeVlaue { get; set; }
public DateTime StartTime { get; set; }
//public string StartTimeVlaue { get; set; }
public DateTime EndTime { get; set; }
//public string EndTimeVlaue { get; set; }
public int Status { get; set; }
public object StatusVlaue { get; set; }
public string Title { get; set; }
public double TotalDistance { get; set; }
public bool applyed { get; set; }
public bool CanJoin { get; set; }
public bool CanStart { get; set; }
public bool CanExit { get; set; }
/// <summary>
/// 服务器当前时间
/// </summary>
public DateTime Now { get; set; }
/// <summary>
/// 第一个冲线时间
/// </summary>
public DateTime? FirstEndTime { get; set; }
/// <summary>
/// 第一个冲线以后,还需要多少分钟自动结束
/// </summary>
public int CloseTime { get; set; }
public bool HasRecord { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 213f656147b58d9468f6d5bf3c54c0e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Apis.Models
{
public class MapCompetitionDetailModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Title { get; set; }
public double LastDistance { get; set; }
public DateTime CreateTime { get; set; }
public double TotalDistance { get; set; }
public int Status { get; set; }
public string Desc { get; set; }
public string Dec { get; set; }
public DateTime StartTime { get; set; }
public bool CanStart { get; set; }
public string CoverImageUrl { get; set; }
public string CompetitionPreviewUrl { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 44ad8036668ddce41b39d57b308e5f11
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Apis.Models
{
public class MapCompetitionModel
{
public int Id { get; set; }
public string Title { get; set; }
public int Status { get; set; }
public DateTime StartTime { get; set; }
public DateTime CreateTime { get; set; }
public int UserCount { get; set; }
public string StatusStr { get; set; }
public string CoverImage { get; set; }
public int MapCompetitionType { get; set; }
public double TotalDistance { get; set; }
public double LastDistance { get; set; }
public bool CanEnter { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8017d7c6d2317804593c9e2a3cd25deb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: