fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 4m27s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 4m27s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
36
WebApi/Controllers/HolidayController.cs
Normal file
36
WebApi/Controllers/HolidayController.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Application;
|
||||
using Application.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace WebApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 节假日控制器
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[AllowAnonymous] // 允许匿名访问
|
||||
public class HolidayController(HolidayApplication holidayApplication) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取指定年月的节假日数据
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<HolidayDto>>> GetMonthHolidays([FromQuery] int year, [FromQuery] int month)
|
||||
{
|
||||
var holidays = await holidayApplication.GetMonthHolidaysAsync(year, month);
|
||||
return holidays.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动同步节假日数据
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<bool>> SyncHolidays([FromQuery] int year)
|
||||
{
|
||||
var result = await holidayApplication.SyncHolidaysAsync(year);
|
||||
return result
|
||||
? result.Ok()
|
||||
: BaseResponse<bool>.Fail("同步失败");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user