31 lines
779 B
C#
Raw Normal View History

2026-04-09 23:12:51 +08:00
using Furion.HttpRemote;
2025-12-17 10:32:52 +08:00
2025-12-17 11:12:13 +08:00
namespace YD_Event.Application;
2025-12-17 10:32:52 +08:00
/// <summary>
/// 第三方API调用
/// </summary>
public class ApiService : IScoped
{
private const string BaseUrl = "https://api.wer.plus";
/// <summary>
/// 检查 文本内容是否包含违禁词
/// </summary>
/// <param name="content">内容</param>
/// <returns></returns>
public async Task<bool> Keywords([FromQuery] string content)
{
try
{
var httpRemoteService = App.GetRequiredService<IHttpRemoteService>();
var dto = await httpRemoteService.GetAsAsync<KeywordsResponseDto>($"{BaseUrl}/api/min");
return dto.Success && dto.Num > 0;
}
2026-04-09 23:12:51 +08:00
catch (Exception)
2025-12-17 10:32:52 +08:00
{
return false;
}
}
}