|
@@ -1,6 +1,9 @@
|
|
|
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
+using Microsoft.AspNetCore.Http.Features;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using Newtonsoft.Json;
|
|
|
using XF.Domain.Constants;
|
|
|
|
|
|
namespace Hotline.Api.Controllers
|
|
@@ -22,20 +25,29 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpGet("ivr/access-confirm")]
|
|
|
public async Task<bool> AccessConfirm([FromQuery]int count)
|
|
|
{
|
|
|
- ////获取是否开启智能语音队列
|
|
|
- //bool isAiIvr = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.IsAIIVR)?.SettingValue[0]);
|
|
|
- //if (!isAiIvr)
|
|
|
- // return false;
|
|
|
-
|
|
|
- ////获取智能语音队列数
|
|
|
- //var queueNum = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.QueueNum)?.SettingValue[0]);
|
|
|
- //if (count < queueNum)
|
|
|
- // return false;
|
|
|
-
|
|
|
- //var aiIVRTimeArr = _systemSettingCacheManager.GetSetting(SettingConstants.AIIVRTime)?.SettingValue;
|
|
|
-
|
|
|
-
|
|
|
- return true;
|
|
|
+ //获取是否开启智能语音队列
|
|
|
+ bool isAiIvr = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.IsAIIVR)?.SettingValue[0]);
|
|
|
+ if (!isAiIvr)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ //获取智能语音队列数
|
|
|
+ var queueNum = int.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.QueueNum)?.SettingValue[0]);
|
|
|
+ if (count <= queueNum)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ //判断是否在时间段内
|
|
|
+ var aiIVRTimeArr = _systemSettingCacheManager.GetSetting(SettingConstants.AIIVRTime)?.SettingValue;
|
|
|
+ bool IsOk = false;
|
|
|
+ aiIVRTimeArr.ForEach((item) => {
|
|
|
+ List<string> times = JsonConvert.DeserializeObject<List<string>>(item);
|
|
|
+ var beginTime = DateTime.Parse(DateTime.Now.ToShortDateString() + " " + times[0] + ":00");
|
|
|
+ var endTime = DateTime.Parse(DateTime.Now.ToShortDateString() + " " + times[1] + ":00");
|
|
|
+ if (DateTime.Now>beginTime && DateTime.Now< endTime)
|
|
|
+ {
|
|
|
+ IsOk = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return IsOk;
|
|
|
}
|
|
|
|
|
|
|