using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using YD_WeChatApplet.Api.Services.Interface;
using YD_WeChatApplet.Commons.Dto.HomeWork;
using YD_WeChatApplet.Commons.Dto.JingShiTiJiao;
using YD_WeChatApplet.Commons.Dto.Patriarch;
using YD_WeChatApplet.Services;
namespace YD_WeChatApplet.Api.Controllers
{
///
/// 公共接口
///
[ApiController]
[ApiExplorerSettings(GroupName = "v1")]
[Route("[controller]")]
[AllowAnonymous]
public class FrameworkController : ControllerBase
{
private readonly IFrameworkService _frameworkService;
public FrameworkController(IFrameworkService frameworkService)
{
_frameworkService = frameworkService;
}
///
/// Ai一体机扫描登录
///
///
///
[HttpPost("ScanCodeLogin")]
public async Task ScanCodeLogin([FromBody] ScanCodeLoginRequest request)
{
if (request==null)
{
throw new Exception("参数为空!");
}
if (string.IsNullOrWhiteSpace(request.Code))
{
throw new Exception("设备编号为空!");
}
if (string.IsNullOrWhiteSpace(request.SchoolCode))
{
throw new Exception("学校编号为空!");
}
if (string.IsNullOrWhiteSpace(request.TeacherNo))
{
throw new Exception("老师编号为空!");
}
return await _frameworkService.ScanCodeLogin(request);
}
}
}