天气预报

This commit is contained in:
yanghongwei 2024-05-20 23:10:31 +08:00
parent 4d5444d8f6
commit 8809e5ccfe
4 changed files with 8 additions and 4 deletions

View File

@ -56,6 +56,7 @@ if (redisoptions != null)
//自动注入 //自动注入
builder.Services.ServicesAutoInjectionExtension(); builder.Services.ServicesAutoInjectionExtension();
builder.Services.AddSocketService(); builder.Services.AddSocketService();
builder.Services.AddHttpClient();
//cross domain //cross domain
builder.Services.AddCors(options => builder.Services.AddCors(options =>
{ {

View File

@ -6,7 +6,7 @@ using System.Linq.Expressions;
namespace langguanApi.Service namespace langguanApi.Service
{ {
[ServiceInjection(InjectionType.Scoped)] [ServiceInjection(InjectionType.Transient)]
public class DeviceService : BaseService<Device> public class DeviceService : BaseService<Device>
{ {
public DeviceService(IConfiguration config) : base(config, nameof(Device)) public DeviceService(IConfiguration config) : base(config, nameof(Device))

View File

@ -9,7 +9,7 @@ namespace langguanApi.Service
/// <summary> /// <summary>
/// HomeService /// HomeService
/// </summary> /// </summary>
[ServiceInjection(InjectionType.Scoped)] [ServiceInjection(InjectionType.Singleton)]
public class HomeService public class HomeService
{ {
private DeviceService _deviceService; private DeviceService _deviceService;
@ -62,7 +62,8 @@ namespace langguanApi.Service
devices, devices,
ariQuality, ariQuality,
Realtime, Realtime,
GetViewTop GetViewTop,
weather
} }
}; };
} }

View File

@ -1,7 +1,9 @@
using Newtonsoft.Json; using langguanApi.Extensions.AutoDI;
using Newtonsoft.Json;
namespace langguanApi.Service namespace langguanApi.Service
{ {
[ServiceInjection(InjectionType.Transient)]
public class WeatherService public class WeatherService
{ {
private IHttpClientFactory _httpClientFactory; private IHttpClientFactory _httpClientFactory;