public IActionResult GetWorksByMonth(int?year, int?month) { try { if (!year.HasValue) { year = DateTime.Now.Year; } if (!month.HasValue) { month = DateTime.Now.Month; } var workItems = _workItemResitory.GetWorkItemsByUserID(UserID, year.Value, month.Value); return(Json(new { result = 1, message = "查询成功", data = workItems }, new JsonSerializerSettings() { DateFormatString = "yyyy年MM月dd日", ContractResolver = new LowercaseContractResolver() })); } catch (Exception exc) { return(Json(new { result = 0, message = $"查询失败:{exc.Message}" }, new JsonSerializerSettings())); } }