✨
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using StopShopping.OpenPlatform;
|
||||
using StopShopping.OpenPlatform.Extensions;
|
||||
using StopShopping.OpenPlatform.TencentLocationApi;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
public static class OpenPlatformExtensions
|
||||
{
|
||||
public static IServiceCollection AddOpenPlatformServices(this IServiceCollection services, IConfiguration openPlatformOptions)
|
||||
{
|
||||
services.Configure<OpenPlatformOptions>(openPlatformOptions);
|
||||
|
||||
services.AddHttpClient();
|
||||
|
||||
services.AddScoped<IDistrictService, TencentDistrictService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
13
StopShopping.OpenPlatform/Extensions/OpenPlatformOptions.cs
Normal file
13
StopShopping.OpenPlatform/Extensions/OpenPlatformOptions.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace StopShopping.OpenPlatform.Extensions;
|
||||
|
||||
public class OpenPlatformOptions
|
||||
{
|
||||
public DistrictOptions TencentDistrict { get; set; } = new();
|
||||
|
||||
public class DistrictOptions
|
||||
{
|
||||
public string? SecretKey { get; set; }
|
||||
public string? Top3LevelUrl { get; set; }
|
||||
public string? GetChildrenUrl { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user