From 7365a23f634b84aca1840ba0ae318f3240e56dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 11:03:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=BD=A8=E8=BF=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=97=B6=E5=8C=BA=E4=B8=8D=E4=BC=A0=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?+8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/GetTrackInput.cs | 8 +++++++- .../Services/ProvideServices/TrackQueryService.cs | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs index 7f6898d7..598ee759 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs @@ -20,7 +20,13 @@ public class GetTrackInput /// 时区 +8 +8.25 -8.5 -9 /// 不传默认+8 /// - public float? TimeZone { get; set; } = 8; + private float? _timeZone; + + public float? TimeZone + { + get => _timeZone ?? 8; + set => _timeZone = value; + } /// /// 排序方式 diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 7b53a713..241d9030 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -55,8 +55,8 @@ public class TrackQueryService : ApplicationService Status = x.TrackStatus, Content = x.TrackContent, Location = x.TrackPlace, - Time = x.TrackTime.AddHours(input.TimeZone!.Value - x.TrackTimeZone), - TimeZone = input.TimeZone!.Value + Time = x.TrackTime.AddHours(input.TimeZone ?? 8 - x.TrackTimeZone), + TimeZone = input.TimeZone ?? 8 }).ToList(); res.Add(item);