using Competition.Common.Util; using CompetitionAPI.api.back; using CompetitionAPI.Util; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.IdentityModel.Tokens; namespace CompetitionAPI.Controllers.back { [Route("api/[controller]")] [ApiController] public class DeleteExamRosterListController : Controller { Competition.Mysql.BLL.pow_exam_users exam_user_bll = new Competition.Mysql.BLL.pow_exam_users(); public DeleteExamRosterListController() { } /// /// 批量删除考试名单接口 /// /// /// [Authorize] [HttpPost] [APIFilter] public JsonResult Index(DeleteExamRosterListRequest req) { try { if (req.ExamUsersIdList.Count == 0) { return Json(Tool.GetJsonWithCode(APICode.Fail, "考试名单id集合不能为空")); } var id_str = string.Join("','", req.ExamUsersIdList); var ret = exam_user_bll.DeleteUserList(id_str); if (ret) { return Json(Tool.GetJsonWithCode(APICode.Success, "删除成功")); } else { return Json(Tool.GetJsonWithCode(APICode.Fail, "删除失败")); } } catch (Exception ex) { LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace); return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。")); } } } }