27 lines
1.1 KiB
C#
27 lines
1.1 KiB
C#
using System.Text.RegularExpressions;
|
|
using YLErp.Web.WebAPI.Models;
|
|
|
|
namespace YLErp.Web.WebAPI.Controllers
|
|
{
|
|
public class CalendarController : BaseController
|
|
{
|
|
[HttpPost("m/api/calendar/for-pricing")]
|
|
public JsonResult GetCalendarDataForPricing(UnderlyingSuggestionRequest req)
|
|
{
|
|
//相信数据的准确性同时年份确定为4位数字
|
|
var dic = CalendarBLL.GetRecentCalendarModel().Select(n => new
|
|
{
|
|
key = n.Year.ToString()
|
|
+ ("chn".Equals(n.Country, StringComparison.OrdinalIgnoreCase) ? "" : n.Country?.ToLowerInvariant()),
|
|
val = string.IsNullOrWhiteSpace(n.HolidayJson)
|
|
? Enumerable.Empty<string>()
|
|
: Regex.Matches(n.HolidayJson, n.Year + @",\d\d,\d\d").Cast<Match>()
|
|
.Select(m => m.Value.Substring(5).Remove(2, 1))
|
|
.OrderBy(m => m).ToArray()
|
|
}).ToDictionary(n => n.key, n => n.val);
|
|
|
|
return JsonSuccess(dic);
|
|
}
|
|
}
|
|
}
|