using System.Text.Json.Serialization; namespace Oshima.FunGame.WebAPI.Model { /// /// 赛事状态 /// public enum EventStatus { /// /// 未开始 /// Upcoming, /// /// 进行中 /// InProgress, /// /// 已结束 /// Completed } /// /// 比赛状态 /// public enum MatchStatus { /// /// 未开始 /// Scheduled, /// /// 正在进行 /// Live, /// /// 已结束 /// Finished } /// /// 投注选项类型 /// public enum BetOptionType { /// /// 队伍1胜 /// Team1Win, /// /// 队伍2胜 /// Team2Win, /// /// 精确比分 /// Score, /// /// 赛事MVP /// MVP } /// /// CS 队伍 /// public class CSTeam { public int Id { get; set; } public string Name { get; set; } = ""; public string LogoUrl { get; set; } = ""; public List Players { get; set; } = []; } /// /// 赛事(Event) /// public class CSEvent { public int Id { get; set; } public string Name { get; set; } = ""; public EventStatus Status { get; set; } public DateTime StartTime { get; set; } public DateTime EndTime { get; set; } public List Matches { get; set; } = []; /// /// MVP 候选人列表(玩家 OpenId 或游戏内 UID) /// public List MVPCandidates { get; set; } = []; } /// /// 单场比赛 /// public class CSMatch { public int Id { get; set; } public int EventId { get; set; } public int Team1Id { get; set; } public int Team2Id { get; set; } public MatchStatus Status { get; set; } public DateTime StartTime { get; set; } public string Stage { get; set; } = ""; /// /// 竞猜截止时间 /// public DateTime BetDeadline { get; set; } /// /// 比赛结果(如 “16:14” 或 “2:1”) /// /// public string? Result { get; set; } /// /// 获胜方(1=Team1,2=Team2,0=平局/未定) /// public int Winner { get; set; } /// /// 支持的投注选项类型(常规包含 Team1Win/Team2Win,总决赛增加 Score) /// public List AvailableOptions { get; set; } = [BetOptionType.Team1Win, BetOptionType.Team2Win]; } /// /// 用户投注记录 /// public class BetRecord { public long Id { get; set; } public long UserId { get; set; } public int MatchId { get; set; } public BetOptionType OptionType { get; set; } /// /// 投注选项内容(如 “Team1Win” 或具体比分 “16:14”) /// public string OptionValue { get; set; } = ""; /// /// 投注金币 /// public long Amount { get; set; } /// /// 投注时间 /// public DateTime BetTime { get; set; } /// /// 是否已结算 /// public bool IsSettled { get; set; } /// /// 结算金额(含本金),未结算为 null /// public long? Payout { get; set; } /// /// 结算备注 /// public string? ResultNote { get; set; } } public class CreateEventRequest { [JsonPropertyName("uid")] public long Uid { get; set; } [JsonPropertyName("name")] public string Name { get; set; } = ""; [JsonPropertyName("start_time")] public DateTime StartTime { get; set; } [JsonPropertyName("end_time")] public DateTime EndTime { get; set; } } public class CreateMatchRequest { [JsonPropertyName("uid")] public long Uid { get; set; } [JsonPropertyName("event_id")] public int EventId { get; set; } [JsonPropertyName("team1_name")] public string Team1Name { get; set; } = ""; [JsonPropertyName("team2_name")] public string Team2Name { get; set; } = ""; [JsonPropertyName("stage")] public string Stage { get; set; } = ""; [JsonPropertyName("start_time")] public DateTime StartTime { get; set; } [JsonPropertyName("bet_deadline")] public DateTime BetDeadline { get; set; } [JsonPropertyName("available_options")] public string AvailableOptions { get; set; } = "team1_win,team2_win"; } }