diff --git a/Communications/Base.cs b/Communications/Base.cs index a9cc3d6..daf191f 100644 --- a/Communications/Base.cs +++ b/Communications/Base.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; -using Newtonsoft.Json.Serialization; namespace YYApi.Communications { @@ -91,7 +90,7 @@ namespace YYApi.Communications { IgnoreReadOnlyProperties = true, PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - Converters = {new JsonStringEnumConverter()} + Converters = { new JsonStringEnumConverter() } }); } } diff --git a/Controllers/BaseController.cs b/Controllers/BaseController.cs index 74e5f21..f972104 100644 --- a/Controllers/BaseController.cs +++ b/Controllers/BaseController.cs @@ -15,7 +15,10 @@ namespace YYApi.Controllers /// public class BaseController : Controller { - protected int LoginId => int.Parse(HttpContext.Items["LoginId"].ToString()); + /// + /// 当前登录用户的ID + /// + protected int LoginId => HttpContext.Items["LoginId"] == null ? 0 : int.Parse(HttpContext.Items["LoginId"].ToString()); /// /// 验证请求参数 diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index 178c853..5987041 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -2,5 +2,15 @@ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true + }, + "profiles": { + "YYApi": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + } } -} +} \ No newline at end of file diff --git a/YYApi.csproj b/YYApi.csproj index c564226..41d7e5e 100644 --- a/YYApi.csproj +++ b/YYApi.csproj @@ -9,7 +9,9 @@ AspNetCore一个方便的API文档,捕获异常,统一输入输出的API类库 YY-Tech.YYApi true - true + snupkg + true + 0.1.2 @@ -21,8 +23,8 @@ - - + +