public List <IndexLotteryInfoResDto> GetLotteryRecordList(string lTypes, DateTime dateTime) { var sql = @"select lr.*,l.lType as BigLType from LotteryRecord lr join( select lType, max(SubTime) SubTime from lotteryRecord where lType in(" + lTypes + ") and SubTime >'" + dateTime + @"' group by lType ) tab on lr.lType = tab.lType and lr.SubTime = tab.SubTime left join LotteryType2 lt on lr.lType = lt.lType left join Lottery l on lr.lType = l.LotteryCode order by Position"; var newList = new List <IndexLotteryInfoResDto>(); Util.ReaderToList <LotteryRecord>(sql).ForEach(e => { IndexLotteryInfoResDto newModel = new IndexLotteryInfoResDto(); newModel.OpenNum = e.Num; newModel.Issue = e.Issue; newModel.OpenTime = e.ShowOpenTime; newModel.OpenNumAlias = ""; newModel.CurrentIssue = ""; newModel.LType = e.lType; newModel.LTypeName = Util.GetLotteryTypeName(e.lType); newModel.Logo = Util.GetLotteryIconUrl(e.lType); newModel.BigLType = e.BigLType; newList.Add(newModel); }); return(newList); }
/// <summary> /// 获取彩种开奖信息 /// </summary> /// <param name="lType">彩种Id</param> /// <returns></returns> public ApiResult <IndexLotteryInfoResDto> GetLotteryInfo(int lType) { var lotteryInfo = GetLotteryType2(lType); if (lotteryInfo == null) { throw new ApiException(40000, "该彩种不存在"); } var info = new IndexLotteryInfoResDto() { LType = lType, LTypeName = Util.GetLotteryTypeName(lType), }; var lastLotteryRecord = GetLotteryRecord(lotteryInfo.lType); if (lastLotteryRecord != null) { info.OpenNum = lastLotteryRecord.Num; info.Issue = lastLotteryRecord.Issue; info.OpenTime = lastLotteryRecord.ShowOpenTime; info.OpenNumAlias = Util.GetShowInfo(lastLotteryRecord.lType, lastLotteryRecord.Num, lastLotteryRecord.SubTime); info.CurrentIssue = LuoUtil.GetCurrentIssue(lType); } info.Logo = Util.GetLotteryIconUrl(lotteryInfo.lType); return(new ApiResult <IndexLotteryInfoResDto>() { Data = info }); }