asg_backend/NewFile.cs
2024-11-16 21:30:23 +08:00

29 lines
736 B
C#

using System.Net.Http;
using System.Threading.Tasks;
public class CaptchaService
{
private readonly HttpClient _httpClient;
public CaptchaService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<bool> ValidateCaptcha(string token, string ip)
{
var requestData = new
{
id = "67134feddc0ff12924d9aaf4",
secretkey = "c3e08b07b8034e6b961f010abed5586a",
scene = 3,
token = token,
ip = ip
};
var response = await _httpClient.PostAsJsonAsync("your-captcha-endpoint", requestData);
var result = await response.Content.ReadAsAsync<dynamic>();
return result.success == 1;
}
}