using Competition.Common.Util; using CompetitionAPI.api.unity; using CompetitionAPI.Util; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.Text; namespace CompetitionAPI.Controllers.unity.study { [Route("unity/[controller]")] [ApiController] public class GetStudyFileController : Controller { Competition.Mysql.BLL.pow_study_file study_file_bll = new Competition.Mysql.BLL.pow_study_file(); public GetStudyFileController() { } /// /// 获取学习资源接口 /// /// 学习id /// [Authorize] [HttpPost] [APIFilter] public JsonResult Index([FromForm] GetStudyFileRequest req) { try { var list = study_file_bll.GetModelList(string.Format(" StudyId='{0}' ", req.StudyId)); return Json(Tool.GetJsonWithCode(APICode.Success, list)); } catch (Exception ex) { LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace); return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。")); } } } }