/// <summary> /// 获取彩种采集详情 /// </summary> /// <param name="lotteryCode"></param> /// <returns></returns> public static List <LotteryPickDetail> GetPickDetail(string lotteryCode) { string sql = $@"select c.code Code, ifnull(b.TodayCount, 0) TodayCount, ifnull(a.TotalCount, 0) TotalCount from data_source c left join (select data_source, count(1) TotalCount from open_result where lottery_code = '{lotteryCode}' group by data_source) a on a.data_source = c.code left join (select data_source, count(1) TodayCount from open_result where lottery_code = '{lotteryCode}' and create_timestamp >= {DateTime.Now.Date.ToTimestamp()} group by data_source) b on b.data_source = c.code"; return(MysqlHelper.GetList <LotteryPickDetail>(sql).ToList()); }
/// <summary> /// 获取采集数量 /// </summary> /// <param name="codeList"></param> /// <returns></returns> public static List <PickCount> GetPickCount(string codeList) { string sql = $@"select c.code Code, ifnull(b.TodayCount, 0) TodayCount, ifnull(a.TotalCount, 0) TotalCount from lottery c left join (select lottery_code, count(1) TotalCount from open_result a where lottery_code in ({codeList}) group by lottery_code) a on a.lottery_code = c.code left join (select lottery_code, count(1) TodayCount from open_result where lottery_code in ({codeList}) and create_timestamp >= {DateTime.Now.Date.ToTimestamp()} group by lottery_code) b on b.lottery_code = c.code where c.code in ({codeList})"; return(MysqlHelper.GetList <PickCount>(sql).ToList()); }
/// <summary> /// 取某一个彩种最新的开奖结果 /// </summary> /// <param name="lotteryType"></param> /// <returns></returns> public static List <OpenResult> GetNewestResult(string lotteryType) { string sql = $"select issue_number, open_time, open_data from open_result where lottery_code = '{lotteryType}' group by issue_number order by issue_number desc limit 20"; return(MysqlHelper.GetList <OpenResult>(sql).ToList()); }
/// <summary> /// 获取所有彩种 /// </summary> /// <returns></returns> public static List <Lottery> GetList() { string sql = "select * from lottery"; return(MysqlHelper.GetList <Lottery>(sql).ToList()); }
/// <summary> /// 获取所有彩种 /// </summary> /// <returns></returns> public static List <DataSource> GetList() { string sql = "select * from data_source"; return(MysqlHelper.GetList <DataSource>(sql).ToList()); }