123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using Hotline.Api.Realtimes;
- using Hotline.Application.Jobs;
- using Hotline.CallCenter.Calls;
- using Hotline.Orders;
- using Hotline.Realtimes;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- using XF.Domain.Repository;
- namespace Hotline.Api.Controllers
- {
- public class CorsJobController: BaseController
- {
- private readonly IOrderDomainService _orderDomainService;
- private readonly IRepository<TrCallRecord> _trcallrecordRepoository;
- private readonly IRealtimeService _realtimeService;
- public CorsJobController(IOrderDomainService orderDomainService)
- {
- _orderDomainService = orderDomainService;
- }
- /// <summary>
- /// 定时发送超期短信
- /// 0 30 09,14 * * ?
- /// </summary>
- /// <returns></returns>
- [HttpGet("send-overtime-sms")]
- [AllowAnonymous]
- public async Task SendOverTimeSms()
- {
- await _orderDomainService.SendOverTimeSms(HttpContext.RequestAborted);
- }
- /// <summary>
- /// 推送当天等待(1分钟一次)
- /// </summary>
- /// <returns></returns>
- [HttpGet("send-todaywaitnum")]
- [AllowAnonymous]
- public async Task SendToDayWaitNum()
- {
- try
- {
- int count = await _trcallrecordRepoository.Queryable()
- .Where(x => x.CreatedTime.Date == DateTime.Now.Date)
- .Where(x => x.QueueTims > 0 && x.Duration == 0)
- .CountAsync();
- await _realtimeService.TodayWaitNumAsync(count, HttpContext.RequestAborted);
- }
- catch { }
- }
- }
- }
|