修改登录模块~支持多用户登录

This commit is contained in:
gongxh
2021-04-26 11:29:45 +08:00
parent d5e2ee0414
commit 3bf3bdb07c
11 changed files with 297 additions and 28 deletions

View File

@@ -8,6 +8,7 @@ namespace NX.ERP.WebAPi
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}

View File

@@ -0,0 +1,30 @@
using NX.ERP.WebAPi.models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers.System
{
public class SystemController:ApiController
{
[HttpPost]
[Route("api/System/Login")]
public string Login(LoginEntity loginEntity)
{
var AccID = ConfigurationManager.AppSettings["AccId"];
//NX.ERP.U8.U8LoginContext.Instance.PassWord = System.Configuration.ConfigurationManager.AppSettings["Password"];
//NX.ERP.U8.U8LoginContext.Instance.UserId = System.Configuration.ConfigurationManager.AppSettings["UserId"];
var Server =ConfigurationManager.AppSettings["Server"];
var _login = new NX.ERP.U8.U8LoginContext(Server, AccID);
_login.Login(loginEntity.UserId, loginEntity.Password);
return _login.loginId;
}
}
}

View File

@@ -57,6 +57,12 @@
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Owin, Version=4.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.4.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd1bb07a5ac7c7bc, processorArchitecture=MSIL">
<HintPath>..\packages\Swashbuckle.Core.5.6.0\lib\net40\Swashbuckle.Core.dll</HintPath>
</Reference>
@@ -168,13 +174,16 @@
<Compile Include="Controllers\Store\SaleStoreOutController.cs" />
<Compile Include="Controllers\Store\StockController.cs" />
<Compile Include="Controllers\Store\StoreController.cs" />
<Compile Include="Controllers\System\SystemController.cs" />
<Compile Include="Filters\ApiResultAttribute.cs" />
<Compile Include="Filters\ExceptionFilter.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="models\LoginEntity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResultModel.cs" />
<Compile Include="Startup.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="favicon.ico" />

18
NX.ERP.WebAPi/Startup.cs Normal file
View File

@@ -0,0 +1,18 @@
using Microsoft.Owin;
using Owin;
using System;
using System.Threading.Tasks;
[assembly: OwinStartup(typeof(NX.ERP.WebAPi.Startup))]
namespace NX.ERP.WebAPi
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
}
}
}

View File

@@ -5,11 +5,11 @@
-->
<configuration>
<appSettings>
<add key="server" value="10.0.0.12"/>
<add key="AccId" value="u8-2@001"/>
<add key="UserId" value="wx997"/>
<add key="Password" value="1"/>
<add key="EaiPort" value="80"/>
<add key="server" value="10.0.0.12" />
<add key="AccId" value="u8-2@001" />
<add key="UserId" value="wx997" />
<add key="Password" value="1" />
<add key="EaiPort" value="80" />
<add key="EaiPath" value="U8EAI/import.asp" />
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace NX.ERP.WebAPi.models
{
public class LoginEntity
{
private string userId;
private string password;
public string UserId { get => userId; set => userId = value; }
public string Password { get => password; set => password = value; }
}
}

View File

@@ -21,9 +21,11 @@
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages.zh-Hans" version="3.2.7" targetFramework="net45" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net45" />
<package id="Microsoft.Owin" version="4.0.1" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Modernizr" version="2.8.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="Swashbuckle" version="5.6.0" targetFramework="net45" />
<package id="Swashbuckle.Core" version="5.6.0" targetFramework="net45" />
<package id="WebActivatorEx" version="2.0" targetFramework="net45" />