using Competition.Common.Util; using CompetitionAPI.api.unity; using CompetitionAPI.Util; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; namespace CompetitionAPI.Controllers.unity { [Route("unity/[controller]")] [ApiController] public class QueryTicketProcController : Controller { Competition.Mysql.BLL.pow_user_operation_proc_ticket bll_pow_user_operation_proc_ticket = new Competition.Mysql.BLL.pow_user_operation_proc_ticket(); public QueryTicketProcController() { } /// /// 查询操作票步骤接口 /// /// /// [Authorize] [HttpPost] [APIFilter] public JsonResult Index([FromForm] QueryTicketProcRequest req) { try { if (string.IsNullOrEmpty(req.ExamId)) { return Json(Tool.GetJsonWithCode(APICode.Fail, "ExamId参数不能为空")); } if (string.IsNullOrEmpty(req.Type)) { return Json(Tool.GetJsonWithCode(APICode.Fail, "Type参数不能为空")); } if (string.IsNullOrEmpty(req.UserId)) { return Json(Tool.GetJsonWithCode(APICode.Fail, "UserId参数不能为空")); } //UserId :用户id //ExamId:考试id //Type:送电、停电 var qry = string.Format(" UserId='{0}' and ExamId='{1}' and Type='{2}' ", req.UserId, req.ExamId, req.Type); var proc_ticket_list = bll_pow_user_operation_proc_ticket.GetModelList(qry).OrderBy(s => s.SerialNumber).ToList(); if (proc_ticket_list.Count > 0) { return Json(Tool.GetJsonWithCode(APICode.Success, new { count = proc_ticket_list.Count.ToString(), data = proc_ticket_list })); } else { return Json(Tool.GetJsonWithCode(APICode.Fail, "记录不存在")); } } catch (Exception ex) { LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace); return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。")); } } } }