45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
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 GetOperationTicketController : Controller
|
|
{
|
|
Competition.Mysql.BLL.pow_exam_operation_ticket exam_operation_ticket_bll = new Competition.Mysql.BLL.pow_exam_operation_ticket();
|
|
|
|
public GetOperationTicketController()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取操作票接口
|
|
/// </summary>
|
|
/// <param name="ExamId">考试id</param>
|
|
/// <param name="Type">类型 停电、送电</param>
|
|
/// <returns></returns>
|
|
[Authorize]
|
|
[HttpGet]
|
|
[APIFilter]
|
|
public JsonResult Index(string ExamId, string Type)
|
|
{
|
|
try
|
|
{
|
|
var ticket_list = exam_operation_ticket_bll.GetModelList(" ExamId='" + ExamId + "' ");
|
|
var power_failure = ticket_list.Where(a => a.Type == Type).OrderBy(a => a.SerialNumber).ToList();
|
|
return Json(Tool.GetJsonWithCode(APICode.Success, power_failure));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace);
|
|
return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。"));
|
|
}
|
|
}
|
|
}
|
|
}
|