日期:2014-05-17 浏览次数:20933 次
public class Info
{
/// <summary>
/// ID
/// </summary>
public int ID { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 阅读次数
/// </summary>
public int ViewTimes { get; set; }
/// <summary>
/// 分类ID
/// </summary>
public int ColumnID { get; set; }
/// <summary>
/// 状态
/// </summary>
public int StateID { get; set; }
}
public class InfoBusiService : AbstractBusiService<Info>
{
public List<Info> GetHotInfoes(int columnID = 0, int maxRows = 10)
{
var infoes = base.GetQueryable(i => i.StateID == 1);
infoes = columnID > 0 ? infoes.Where(i => i.ColumnID == columnID) : infoes;
//排行计算规则:N=X+A-B
//1) N:排行计算值
//2) X=阅读数
//3) A=创建时间.hh×60+创建时间.mm
//4) B=(当前日期-创建时间.dd)×1000
// 这个排序应该怎么写???
return infoes.Take(maxRows).ToList();
}
}