6 changed files with 107 additions and 49 deletions
@ -0,0 +1,24 @@ |
|||||
|
using BBWYB.Server.Business.Sync; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace BBWYB.Server.API.Controllers |
||||
|
{ |
||||
|
public class TimeLimitTaskSyncController : BaseApiController |
||||
|
{ |
||||
|
private TimeLimitTaskSyncBusiness timeLimitTaskSyncBusiness; |
||||
|
public TimeLimitTaskSyncController(IHttpContextAccessor httpContextAccessor, TimeLimitTaskSyncBusiness timeLimitTaskSyncBusiness) : base(httpContextAccessor) |
||||
|
{ |
||||
|
this.timeLimitTaskSyncBusiness = timeLimitTaskSyncBusiness; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 检查任务过期
|
||||
|
/// </summary>
|
||||
|
[HttpPost] |
||||
|
public void CheckTask() |
||||
|
{ |
||||
|
timeLimitTaskSyncBusiness.CheckTask(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
using BBWYB.Common.Log; |
||||
|
using BBWYB.Common.Models; |
||||
|
using BBWYB.Server.Model.Db; |
||||
|
using Yitter.IdGenerator; |
||||
|
|
||||
|
namespace BBWYB.Server.Business.Sync |
||||
|
{ |
||||
|
public class TimeLimitTaskSyncBusiness : BaseBusiness, IDenpendency |
||||
|
{ |
||||
|
//private TaskSchedulerManager taskSchedulerManager;
|
||||
|
public TimeLimitTaskSyncBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator) : base(fsql, nLogManager, idGenerator) |
||||
|
{ |
||||
|
//this.taskSchedulerManager = taskSchedulerManager;
|
||||
|
} |
||||
|
|
||||
|
public void CheckTask() |
||||
|
{ |
||||
|
fsql.Update<TimeLimitTask>().Set(t => t.IsTimely, false) |
||||
|
.Where(t => t.CompletionTime == null) |
||||
|
.Where(t => t.ExpirationTime < DateTime.Now) |
||||
|
.ExecuteAffrows(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
using BBWYB.Server.Model.Db; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class TimeLimitTaskResponse : TimeLimitTask |
||||
|
{ |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue