diff --git a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs index b6f35b6..0e0366e 100644 --- a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs +++ b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs @@ -55,27 +55,9 @@ namespace ZR.Admin.WebApi.Extensions Title = "ZrAdmin.NET Api", Version = "v1", Description = "系统管理", - Contact = new OpenApiContact { Name = "ZRAdmin doc", Url = new Uri("https://www.izhaorui.cn/doc") } - }); - c.SwaggerDoc("article", new OpenApiInfo - { - Title = "ZrAdmin.NET Api", - Version = "v1", - Description = "文章管理", - Contact = new OpenApiContact { Name = "ZRAdmin doc", Url = new Uri("https://www.izhaorui.cn/doc") } - }); - c.SwaggerDoc("shopping", new OpenApiInfo - { - Title = "ZrAdmin.NET Api", - Version = "v1", - Description = "商城管理", - }); - c.SwaggerDoc("v1", new OpenApiInfo - { - Title = "ZrAdmin.NET Api", - Version = "v1", - Description = "", + Contact = new OpenApiContact { Name = "Admin doc", Url = new Uri("") } }); + try { //var tempPath = hostEnvironment.ContentRootPath; diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index 1e919d4..8b25e9d 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -79,7 +79,11 @@ if (openRedis == "1") { RedisServer.Initalize(); } - +var GaoDeKey = builder.Configuration["GaoDe:Key"]; +if (!string.IsNullOrEmpty(GaoDeKey)) +{ + GeoCodeService.ApiKey = GaoDeKey; +} builder.Services.AddMvc(options => { options.Filters.Add(typeof(GlobalActionMonitor));//全局注册 diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json index 5998efe..9cb19f9 100644 --- a/ZR.Admin.WebApi/appsettings.json +++ b/ZR.Admin.WebApi/appsettings.json @@ -108,6 +108,9 @@ "CaptchaOptions": { "IgnoreCase": true // 比较时是否忽略大小写 }, + "GaoDe": { + "Key": "938a85a1cc3114b200522fb7ee579b27" //高德地图key + }, //代码生成配置 "CodeGen": { //uniapp 版本号2/3(vue版本号) diff --git a/ZR.Common/GeoCodeService.cs b/ZR.Common/GeoCodeService.cs index af93469..96051e3 100644 --- a/ZR.Common/GeoCodeService.cs +++ b/ZR.Common/GeoCodeService.cs @@ -10,8 +10,8 @@ namespace ZR.Common; /// public class GeoCodeService { - private const string ApiKey = "675b1cc0e0d2e61fd475b668b9fd869d"; - private const string BaseUrl = "https://restapi.amap.com/v3/geocode/regeo"; + public static string ApiKey = "938a85a1cc3114b200522fb7ee579b27"; + public const string BaseUrl = "https://restapi.amap.com/v3/geocode/regeo"; private readonly HttpClient _httpClient;