CompetitionAPI_dotnet/CompetitionAPI/Controllers/back/GetSceneController.cs

42 lines
1.1 KiB
C#

using Competition.Common.Util;
using CompetitionAPI.Util;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace CompetitionAPI.Controllers.back
{
[Route("api/[controller]")]
[ApiController]
public class GetSceneController : Controller
{
Competition.Mysql.BLL.pow_scene scene_bll = new Competition.Mysql.BLL.pow_scene();
public GetSceneController()
{
}
/// <summary>
/// 获取场景接口
/// </summary>
/// <returns></returns>
[Authorize]
[HttpGet]
[APIFilter]
public JsonResult Index()
{
try
{
var list = scene_bll.GetModelList("");
return Json(Tool.GetJsonWithCode(APICode.Success, list));
}
catch (Exception ex)
{
LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace);
return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。"));
}
}
}
}