2026-02-03 16:07:59 +08:00

54 lines
1.7 KiB
C#

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
{
/// <summary>
/// 公共接口
/// </summary>
[ApiController]
[ApiExplorerSettings(GroupName = "v1")]
[Route("[controller]")]
[AllowAnonymous]
public class FrameworkController : ControllerBase
{
private readonly IFrameworkService _frameworkService;
public FrameworkController(IFrameworkService frameworkService)
{
_frameworkService = frameworkService;
}
/// <summary>
/// Ai一体机扫描登录
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("ScanCodeLogin")]
public async Task<bool> ScanCodeLogin(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);
}
}
}