63 lines
2.0 KiB
C#
63 lines
2.0 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 UpdateClimbrodController : Controller
|
|
{
|
|
Competition.Mysql.BLL.pow_user_exam user_exam_bll = new Competition.Mysql.BLL.pow_user_exam();
|
|
|
|
public UpdateClimbrodController()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新爬杆结果接口
|
|
/// </summary>
|
|
/// <param name="req"></param>
|
|
/// <returns></returns>
|
|
[Authorize]
|
|
[HttpPost]
|
|
[APIFilter]
|
|
public JsonResult Index([FromForm] UpdateClimbrodRequest req)
|
|
{
|
|
try
|
|
{
|
|
var user_exam_model = user_exam_bll.GetModelList(" ExamId='" + req.ExamId + "' and UserId='" + req.UserId + "' ").FirstOrDefault();
|
|
if (user_exam_model != null)
|
|
{
|
|
if (user_exam_model.Status == "已结束")
|
|
{
|
|
return Json(Tool.GetJsonWithCode(APICode.Fail, "考生考试已结束"));
|
|
}
|
|
|
|
if (user_exam_bll.UpdateClimbrod(user_exam_model.UserExamId))
|
|
{
|
|
return Json(Tool.GetJsonWithCode(APICode.Success, "成功"));
|
|
}
|
|
else
|
|
{
|
|
return Json(Tool.GetJsonWithCode(APICode.Fail, "失败"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return Json(Tool.GetJsonWithCode(APICode.Fail, "考生考试信息不存在"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace);
|
|
return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。"));
|
|
}
|
|
}
|
|
}
|
|
}
|