Просмотр исходного кода

支持虚拟目录,支持文档注释

shengxuefei 4 лет назад
Родитель
Сommit
b07e728953

BIN
PMS.NetCore/.vs/PMS.NetCore/DesignTimeBuild/.dtbcache.v2


+ 12 - 0
PMS.NetCore/PMS.NetCore/.config/dotnet-tools.json

@@ -0,0 +1,12 @@
+{
+  "version": 1,
+  "isRoot": true,
+  "tools": {
+    "dotnet-ef": {
+      "version": "5.0.6",
+      "commands": [
+        "dotnet-ef"
+      ]
+    }
+  }
+}

+ 19 - 2
PMS.NetCore/PMS.NetCore/Controllers/UserController.cs

@@ -52,7 +52,23 @@ namespace PMS.NetCore.Controllers
             _configuration = configuration;
             tokenHelper = _tokenHelper;
         }
-
+        /// <summary>
+        /// test
+        /// </summary>
+        /// <returns></returns>
+        [AllowAnonymous]
+        [HttpGet]
+        [Route("test")]
+        public JsonResult test()
+        {
+            var str = "success";
+            return Json(str);
+        }
+        /// <summary>
+        /// 用户登录
+        /// </summary>
+        /// <param name="request">用户名,密码</param>
+        /// <returns></returns>
         [AllowAnonymous]
         [HttpPost]
         [Route("")]
@@ -81,6 +97,7 @@ namespace PMS.NetCore.Controllers
                 var rolesList = new rolesManager().GetRoles(user.StaffCode);
                 loginUser.Roles = rolesList;
                 loginUser.User = user;
+                loginUser.User.Password = "";    //密码不返回接口
 
             }
             else
@@ -100,7 +117,7 @@ namespace PMS.NetCore.Controllers
             loginUser.License = new licenseManager().GetList().FirstOrDefault();
             loginUser.DeptName = new deptsManager().Db.Queryable<depts>().First(m => m.DeptCode == loginUser.User.DeptCode)?.DeptName;
 
-            //获取令牌,返回客户端 
+            //获取令牌,返回客户端
             Dictionary<string, string> keyValuePairs = new Dictionary<string, string>
                     {
                         { "UserID", user.UserID }

+ 10 - 1
PMS.NetCore/PMS.NetCore/PMS.NetCore.csproj

@@ -2,6 +2,15 @@
 
   <PropertyGroup>
     <TargetFramework>net5.0</TargetFramework>
+    <UserSecretsId>6f5d2b4b-7967-454a-924b-6f83cc425aab</UserSecretsId>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+    <DocumentationFile>D:\路涛科技\源代码\物业系统netcore版\PropertyManagementSystem.NetCore\PMS.NetCore\PMS.NetCore\PMS.NetCore.xml</DocumentationFile>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
+    <DocumentationFile>D:\路涛科技\源代码\物业系统netcore版\PropertyManagementSystem.NetCore\PMS.NetCore\PMS.NetCore\PMS.NetCore.xml</DocumentationFile>
   </PropertyGroup>
 
   <ItemGroup>
@@ -10,7 +19,7 @@
     <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.3" />
     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.3" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.3" />
-    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
+    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
   </ItemGroup>
 
   <ItemGroup>

+ 68 - 0
PMS.NetCore/PMS.NetCore/PMS.NetCore.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>PMS.NetCore</name>
+    </assembly>
+    <members>
+        <member name="F:PMS.NetCore.Controllers.UserController.EncryptKeyStr">
+            <summary>
+            加密关键字
+            </summary>
+        </member>
+        <member name="F:PMS.NetCore.Controllers.UserController.tokenHelper">
+            <summary>
+            令牌获取和验证类
+            </summary>
+        </member>
+        <member name="M:PMS.NetCore.Controllers.UserController.test">
+            <summary>
+            test
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="M:PMS.NetCore.Controllers.UserController.ValidateUser(Sugar.Enties.UserLoginDTO)">
+            <summary>
+            用户登录
+            </summary>
+            <param name="request">用户名,密码</param>
+            <returns></returns>
+        </member>
+        <member name="M:PMS.NetCore.Controllers.UserController.ComparePasswords(System.String,System.String)">
+            <summary>
+            比较存储在数据库中的用户密码和输入的用户密码是否一致
+            </summary>
+            <param name="storedPassword">存储在数据库中的用户密码</param>
+            <param name="inputPassword">输入的用户密码</param>
+            <returns>true or false</returns>
+        </member>
+        <member name="M:PMS.NetCore.Controllers.UserController.Encrypt(System.String,System.String)">
+            <summary>
+            加密
+            </summary>
+            <param name="datastr">要加密的字符串</param>
+            <param name="keystr">机密密钥</param>
+            <returns>加密后的字符串</returns>
+        </member>
+        <member name="M:PMS.NetCore.Controllers.UserController.Decrypt(System.String,System.String)">
+            <summary>
+            解密
+            </summary>
+            <param name="datastr">要解密的字符串</param>
+            <param name="keystr">机密密钥</param>
+            <returns>解密后的字符串</returns>
+        </member>
+        <member name="M:PMS.NetCore.Filter.TokenAuthorize.#ctor(Utils.Jwt.ITokenHelper)">
+            <summary>
+            滤器实现通用token验证
+            </summary>
+            <param name="_tokenHelper"></param>
+        </member>
+        <member name="M:PMS.NetCore.Filter.TokenAuthorize.HasAllowAnonymous(Microsoft.AspNetCore.Mvc.Filters.AuthorizationFilterContext)">
+            <summary>
+            用于判断Action有没有AllowAnonymous标签
+            </summary>
+            <param name="context"></param>
+            <returns></returns>
+        </member>
+    </members>
+</doc>

+ 16 - 0
PMS.NetCore/PMS.NetCore/Properties/PublishProfiles/FolderProfile.pubxml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+https://go.microsoft.com/fwlink/?LinkID=208121. 
+-->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <DeleteExistingFiles>False</DeleteExistingFiles>
+    <ExcludeApp_Data>False</ExcludeApp_Data>
+    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
+    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
+    <LastUsedPlatform>Any CPU</LastUsedPlatform>
+    <PublishProvider>FileSystem</PublishProvider>
+    <PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+  </PropertyGroup>
+</Project>

+ 11 - 2
PMS.NetCore/PMS.NetCore/Startup.cs

@@ -13,6 +13,8 @@ using Quartz;
 using Quartz.Impl;
 using Sugar.Enties;
 using System;
+using System.IO;
+using System.Reflection;
 using Utils;
 using Utils.Jwt;
 
@@ -38,7 +40,7 @@ namespace PMS.NetCore
             services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();
 
             // TODO create options classes for app settings
-            var identityConn = AppSettingsHelper.Configuration["Logging:AppSettings:ConnectionString"];
+            var identityConn = AppSettingsHelper.Configuration["AppSettings:ConnectionString"];
 
             //identityConn = identityConn.Replace(CONTENTROOTPATHTOKEN, _env.ContentRootPath);
 
@@ -90,12 +92,19 @@ namespace PMS.NetCore
             services.AddSingleton<IConfiguration>(Configuration);
             services.AddSingleton<ICaching, Caching>();
 
-            services.AddControllers();
+
             services.AddSwaggerGen(c =>
             {
                 c.SwaggerDoc("v1", new OpenApiInfo { Title = "PMS.NetCore API——Net5.0", Version = "v1" });
+                // 为 Swagger 设置xml文档注释路径
+                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
+                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
+                // 添加控制器层注释,true表示显示控制器注释
+                c.IncludeXmlComments(xmlPath, true);
 
             });
+            services.AddControllers();
+
         }
 
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

+ 15 - 0
PMS.NetCore/PMS.NetCore/WeatherForecast.cs

@@ -0,0 +1,15 @@
+using System;
+
+namespace PMS.NetCore
+{
+    public class WeatherForecast
+    {
+        public DateTime Date { get; set; }
+
+        public int TemperatureC { get; set; }
+
+        public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
+
+        public string Summary { get; set; }
+    }
+}

+ 1 - 1
PMS.NetCore/PMS.NetCore/appsettings.json

@@ -1,6 +1,6 @@
 {
   "isIIS": false,
-  "virtualPath": "/eq",
+  "virtualPath": "/wycore",
   "Logging": {
     "IncludeScopes": false,
     "Debug": {