This commit is contained in:
Bob.Song
2026-03-27 17:55:04 +08:00
parent a924cd9c01
commit d5dafd2bcf
11 changed files with 114 additions and 200 deletions

View File

@@ -0,0 +1,40 @@
using System.Threading;
using Fantasy;
using Fantasy.Async;
using Fantasy.Network.HTTP;
using Microsoft.AspNetCore.Mvc;
namespace NBF;
[ApiController]
[Route("api/[controller]")]
[ServiceFilter(typeof(SceneContextFilter))]
public class AuthController : ControllerBase
{
private readonly Scene _scene;
/// <summary>
/// 构造函数依赖注入
/// </summary>
/// <param name="scene"></param>
public AuthController(Scene scene)
{
_scene = scene;
}
[HttpGet("login")]
public async FTask<IActionResult> Login()
{
await DingTalkHelper.SendCAPTCHA("123456");
await FTask.CompletedTask;
return Ok($"Hello from the Fantasy controller! _scene.SceneType:{_scene.SceneType} _scene.SceneType:{_scene.SceneConfigId}");
}
[HttpGet("code")]
public async FTask<IActionResult> SendCode()
{
await DingTalkHelper.SendCAPTCHA("123456");
await FTask.CompletedTask;
return Ok($"Hello from the Fantasy controller! _scene.SceneType:{_scene.SceneType} _scene.SceneType:{_scene.SceneConfigId}");
}
}