51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using Competition.Common.Util;
|
|
using CompetitionAPI.api.unity;
|
|
using CompetitionAPI.Util;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace CompetitionAPI.Controllers.unity
|
|
{
|
|
[Route("unity/[controller]")]
|
|
[ApiController]
|
|
public class GetExamStatusController : Controller
|
|
{
|
|
Competition.Mysql.BLL.pow_exam exam_bll = new Competition.Mysql.BLL.pow_exam();
|
|
|
|
public GetExamStatusController()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取考试状态接口
|
|
/// </summary>
|
|
/// <param name="ExamId">考试id</param>
|
|
/// <returns></returns>
|
|
[Authorize]
|
|
[HttpPost]
|
|
[APIFilter]
|
|
public JsonResult Index([FromForm] GetExamStatusRequest req)
|
|
{
|
|
try
|
|
{
|
|
var exam_model = exam_bll.GetModel(req.ExamId);
|
|
if (exam_model.Status == "已结束")
|
|
{
|
|
return Json(Tool.GetJsonWithCode(APICode.Success, "true"));
|
|
}
|
|
else
|
|
{
|
|
return Json(Tool.GetJsonWithCode(APICode.Success, "false"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace);
|
|
return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。"));
|
|
}
|
|
}
|
|
}
|
|
}
|