From cebb8054d40f556a837c519231432b2855bccb9c Mon Sep 17 00:00:00 2001 From: BennyZhao Date: Mon, 25 Apr 2022 16:45:05 +0800 Subject: [PATCH] https://github.com/zhaopeiym/quartzui/issues/73#issuecomment-1090075047 --- QuartzNetAPI/Host/Controllers/SetingController.cs | 2 +- QuartzNetAPI/Host/Entity/RefreshIntervalEntity.cs | 2 +- .../src/app/task-list/task-list/task-list.component.ts | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/QuartzNetAPI/Host/Controllers/SetingController.cs b/QuartzNetAPI/Host/Controllers/SetingController.cs index 553ddde..c08ddc5 100644 --- a/QuartzNetAPI/Host/Controllers/SetingController.cs +++ b/QuartzNetAPI/Host/Controllers/SetingController.cs @@ -180,7 +180,7 @@ private async Task GetLoginAsync() [HttpPost] public async Task GetRefreshInterval() { - return JsonConvert.DeserializeObject(await System.IO.File.ReadAllTextAsync(refreshIntervalPath)); + return JsonConvert.DeserializeObject(await System.IO.File.ReadAllTextAsync(refreshIntervalPath)) ?? new RefreshIntervalEntity(); } /// diff --git a/QuartzNetAPI/Host/Entity/RefreshIntervalEntity.cs b/QuartzNetAPI/Host/Entity/RefreshIntervalEntity.cs index 402d052..53dba0d 100644 --- a/QuartzNetAPI/Host/Entity/RefreshIntervalEntity.cs +++ b/QuartzNetAPI/Host/Entity/RefreshIntervalEntity.cs @@ -10,6 +10,6 @@ public class RefreshIntervalEntity /// /// 间隔时间 /// - public int IntervalTime { get; set; } + public int IntervalTime { get; set; } = 10; } } diff --git a/QuartzNetWeb/src/app/task-list/task-list/task-list.component.ts b/QuartzNetWeb/src/app/task-list/task-list/task-list.component.ts index 97e8382..0efe0af 100644 --- a/QuartzNetWeb/src/app/task-list/task-list/task-list.component.ts +++ b/QuartzNetWeb/src/app/task-list/task-list/task-list.component.ts @@ -94,7 +94,10 @@ export class TaskListComponent implements OnInit { getRefreshInterval() { var url = this.baseUrl + "/api/Seting/GetRefreshInterval"; this.http.post(url, {}, (result: any) => { - this.refreshValue = result.intervalTime * 1000; + if (!result || result.intervalTime === null || result.intervalTime === undefined) + this.refreshValue = 10 * 1000; + else + this.refreshValue = result.intervalTime * 1000; }, (err) => { });