46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using Competition.Common.Util;
|
|
using CompetitionAPI.Util;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Text;
|
|
|
|
namespace CompetitionAPI.Controllers.back.analysis
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class GetStudyController : Controller
|
|
{
|
|
Competition.Mysql.BLL.admin_user user_bll = new Competition.Mysql.BLL.admin_user();
|
|
|
|
Competition.Mysql.BLL.pow_study_record record_bll = new Competition.Mysql.BLL.pow_study_record();
|
|
|
|
public GetStudyController()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取已发布各个学习的已学习学生数量和未学习学生数量接口
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[Authorize]
|
|
[HttpGet]
|
|
[APIFilter]
|
|
public JsonResult Index()
|
|
{
|
|
try
|
|
{
|
|
var student_count = user_bll.GetRecordCount(" role_id='2' ");
|
|
var list = record_bll.GetStudyList();
|
|
return Json(Tool.GetJsonWithCode(APICode.Success, new { total = student_count, list = list }));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace);
|
|
return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。"));
|
|
}
|
|
}
|
|
}
|
|
}
|