work/Views/Home/Search.cshtml

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@using work.Models;
@using work.Models.Database;
@{
	Layout = "_layout";
	var newsList = ViewData["newsList"] as List<Article>;
	/// <summary>
	/// 格式化发布时间
	/// </summary>
	/// <param name="time">时间</param>
	/// <returns>规定格式的时间</returns>
	string GetTimeInterval(DateTime time)
	{
		int hour = 0;
		if (time.Year == DateTime.Now.Year && time.Month == DateTime.Now.Month && time.Day == DateTime.Now.Day)
		{
			if (DateTime.Now.Hour - time.Hour == 0)
			{
				if (DateTime.Now.Minute - time.Minute < 5)
				{
					return "刚刚";

				}
				else
				{
					return (DateTime.Now.Minute - time.Minute).ToString() + "分钟前";

				}
			}
			hour = DateTime.Now.Hour - time.Hour;
			return hour + "小时前";
		}
		else if (time.Year == DateTime.Now.Year && (time.Month == DateTime.Now.Month || time.Month != DateTime.Now.Month) && time.Day != DateTime.Now.Day)
		{
			return String.Format("{0}月{1}日", time.Month, time.Day);
		}
		else
		{
			return String.Format("{0}年{1}月{2}日", time.Year, time.Month, time.Day);
		}
	}
}

@section css{
	<link rel="stylesheet" href="~/css/index.css">
	<style>

		.news-list {
			border-right: 2px solid #ccc;
		}

			.news-list > li {
				border-bottom: 2px solid #ccc;
			}
	</style>
}

	<h2 style="border-bottom:2px solid #ccc">查询结果</h2>
后面还有 20 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。