using Competition.Common.Util; using CompetitionAPI.Util; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace CompetitionAPI.Controllers.back { [Route("api/[controller]")] [ApiController] public class GetAllFaultListController : Controller { Competition.Mysql.BLL.pow_exam_fault exam_fault_bll = new Competition.Mysql.BLL.pow_exam_fault(); public GetAllFaultListController() { } /// /// 根据考试id或实训id获取所有故障数据接口 /// /// 考试id /// [Authorize] [HttpGet] [APIFilter] public JsonResult Index(string ExamId) { try { var fault_list = exam_fault_bll.GetModelList(" ExamId = '" + ExamId + "' order by CreateTime asc "); return Json(Tool.GetJsonWithCode(APICode.Success, fault_list)); } catch (Exception ex) { LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace); return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。")); } } } }