This commit is contained in:
SpecialX
2025-06-25 17:21:29 +08:00
parent f9ff57ff72
commit 262e7d6396
21 changed files with 1491 additions and 152 deletions

View File

@@ -1,15 +1,18 @@
using Entities.DTO;
using System.Net.Http.Json;
using System.Net.Http.Json;
using TechHelper.Client.HttpRepository;
namespace TechHelper.Client.Services
{
public class ClasssServices : IClassServices
{
private readonly HttpClient _client;
private readonly IAuthenticationClientService _authenticationClientService;
public ClasssServices(HttpClient client)
public ClasssServices(HttpClient client, IAuthenticationClientService authenticationClientService)
{
_client = client;
_authenticationClientService = authenticationClientService;
}
public Task<ResponseDto> CreateClass(UserRegistrationToClassDto userClass)
@@ -25,6 +28,8 @@ namespace TechHelper.Client.Services
userRegistrationToClassDto);
var data = await result.Content.ReadAsStringAsync();
await _authenticationClientService.RefreshTokenAsync();
return new ResponseDto
{
IsSuccessfulRegistration = result.IsSuccessStatusCode,

View File

@@ -9,13 +9,13 @@ namespace TechHelper.Client.Services
{
public class ExamService : IExamService
{
private readonly IAIService _aIService; // 遵循命名规范,字段前加下划线
private readonly HttpClient _client; // 直接注入 HttpClient
private readonly IAIService _aIService;
private readonly HttpClient _client;
public ExamService(IAIService aIService, HttpClient client) // 修正点:直接注入 HttpClient
public ExamService(IAIService aIService, HttpClient client)
{
_aIService = aIService;
_client = client; // 赋值注入的 HttpClient 实例
_client = client;
}
public ApiResponse ConvertToXML<T>(string xmlContent)