renmingwang
2026-03-25 6d56bf4daf08c4c7c6d193d98ed0b547dc473451
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/Task_HtyController.cs
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Core;
@@ -19,5 +19,25 @@
        public Task_HtyController(ITask_HtyService service) : base(service)
        {
        }
        /// <summary>
        /// åˆ é™¤æ—§çš„历史任务数据
        /// </summary>
        /// <param name="keepMonths">保留的月数,默认为3个月(本月+后两个月)</param>
        /// <returns>删除的记录数</returns>
        [HttpGet, Route("DeleteOldHistory")]
        [AllowAnonymous]
        public IActionResult DeleteOldHistory(int keepMonths = 3)
        {
            try
            {
                int result = Service.DeleteOldTaskHistory(keepMonths);
                return Ok(new { Success = true, Message = "历史任务删除成功", DeletedCount = result });
            }
            catch (Exception ex)
            {
                return Ok(new { Success = false, Message = "历史任务删除失败: " + ex.Message });
            }
        }
    }
}