Skip to content

Commit

Permalink
主页获取发行游戏列表只比较日期
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleFish-233 committed Apr 28, 2023
1 parent d74074f commit 73b20cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Expand Up @@ -42,10 +42,10 @@ public class HomeService : IHomeService
public async Task<List<MainImageCardModel>> GetHomeNewestGameViewAsync()
{
var model = new List<MainImageCardModel>();
var dateTime = DateTime.Now.ToCstTime();
var dateTime = DateTime.Now.ToCstTime().Date;
//获取即将发售
var entry_result1 = await _entryRepository.GetAll().AsNoTracking()
.Where(s => s.Type == EntryType.Game && s.Name != null && s.Name != "" && s.IsHidden != true && s.PubulishTime > dateTime)
.Where(s => s.Type == EntryType.Game && s.Name != null && s.Name != "" && s.IsHidden != true && s.PubulishTime!=null&& s.PubulishTime.Value.Date > dateTime)
.OrderBy(s => s.PubulishTime).Take(12).ToListAsync();
if (entry_result1 != null)
{
Expand All @@ -71,12 +71,12 @@ public async Task<List<MainImageCardModel>> GetHomeNewestGameViewAsync()
public async Task<List<MainImageCardModel>> GetHomeRecentEditViewAsync()
{
var model = new List<MainImageCardModel>();
var tempDateTimeNow = DateTime.Now.ToCstTime();
var tempDateTimeNow = DateTime.Now.ToCstTime().Date;

var entryIds = await _entryRepository.GetAll().AsNoTracking().OrderByDescending(s => s.PubulishTime)
.Where(s => s.Type == EntryType.Game && s.PubulishTime < tempDateTimeNow && s.Name != null && s.Name != "" && s.IsHidden != true).Select(s => s.Id).Take(12).ToListAsync();
.Where(s => s.Type == EntryType.Game && s.PubulishTime !=null&&s.PubulishTime.Value.Date < tempDateTimeNow && s.Name != null && s.Name != "" && s.IsHidden != true).Select(s => s.Id).Take(12).ToListAsync();
entryIds.AddRange(await _entryRepository.GetAll().AsNoTracking()
.Where(s => s.Type == EntryType.Game && s.Name != null && s.Name != "" && s.IsHidden != true && s.PubulishTime > tempDateTimeNow)
.Where(s => s.Type == EntryType.Game && s.Name != null && s.Name != "" && s.IsHidden != true && s.PubulishTime!=null&& s.PubulishTime.Value.Date > tempDateTimeNow)
.OrderBy(s => s.PubulishTime).Select(s => s.Id).Take(12).ToListAsync());


Expand Down
1 change: 1 addition & 0 deletions CnGalWebSite/CnGalWebSite.DrawingBed/Program.cs
@@ -1,4 +1,5 @@
using Autofac.Core;
using CnGalWebSite.Core.Services.Query;
using CnGalWebSite.DrawingBed.DataReositories;
using CnGalWebSite.DrawingBed.Infrastructure;
using CnGalWebSite.DrawingBed.Services;
Expand Down
Expand Up @@ -311,7 +311,7 @@ public enum SearchType
Game,
[Display(Name = "角色")]
Role,
[Display(Name = "制作组")]
[Display(Name = "组织")]
ProductionGroup,
[Display(Name = "STAFF")]
Staff,
Expand Down

0 comments on commit 73b20cb

Please sign in to comment.