public Respbase <List <AuctionDetailsDto> > GetAuctionDetails(ReqAuctionDetails req) { var data = facade.GetAuctionDetails(req); if (data == null) { return(new Respbase <List <AuctionDetailsDto> > { Result = 0, Message = facade.PromptInfo.Message }); } return(new Respbase <List <AuctionDetailsDto> > { Result = 1, Data = data }); }
/// <summary> /// 获取竞拍详情 /// </summary> /// <param name="req"></param> /// <returns></returns> public List <AuctionDetailsDto> GetAuctionDetails(ReqAuctionDetails req) { DateTime beginDate = DateTime.MinValue, endDate = DateTime.MinValue; var now = DateTime.Now; switch (req.QueryTimeType) { case 1: if (now.Day > 7) { beginDate = now.AddDays(-6).Date; } else { beginDate = now.AddDays(1 - now.Day).Date; } endDate = now.AddDays(1).Date.AddSeconds(-1); break; case 2: if (now.Day <= 7) { Alert("没有7天前的数据"); return(null); } beginDate = now.AddDays(1 - now.Day).Date; endDate = now.AddDays(-6).Date.AddSeconds(-1); break; case 3: beginDate = now.AddDays(1 - now.Day).Date; endDate = now.AddDays(1 - now.Day).Date.AddMonths(1).AddSeconds(-1); break; default: Alert("参数错误"); return(null); } string sql = $@"select TO_CHAR(createtime,'MM-dd')as createdate,PRICE,sum(num)as num from tpxin_pai_his WHERE createtime>= TO_DATE('{beginDate}', 'yyyy-MM-dd HH24:mi:ss') and createtime<= TO_DATE('{endDate}', 'yyyy-MM-dd HH24:mi:ss') GROUP BY PRICE,TO_CHAR(createtime, 'MM-dd') ORDER BY TO_CHAR(createtime, 'MM-dd') "; return(db.Database.SqlQuery <AuctionDetailsDto>(sql).ToList()); }