Commit a36f911c authored by 黄奎's avatar 黄奎

页面修改

parent 0046a5dc
{
"version": 1,
"dgSpecHash": "oFP36aTWSefHN0ZVnyqxX7jI9/JiVlGC5sshaQSYqDZj+6NRSCIh0GaCRE68l00pJI2k8ybusb1xcRAW1+ce9g==",
"success": true
}
\ No newline at end of file
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "3.1.3",
"commands": [
"dotnet-ef"
]
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common;
using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Mall.WebApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiFilter]
[EnableCors("AllowCors")]
public class BaseController : ControllerBase
{
/// <summary>
/// 整理前端传递的post参数
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
public RequestParm RequestParm
{
get
{
#region 读取post参数
var requestMsg = Request.HttpContext.Items[GlobalKey.UserPostInfo];
var requestParm = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
var UObj = Request.HttpContext.Items[GlobalKey.TokenUserInfo];
if (UObj != null)
{
JObject parms = JObject.Parse(UObj.ToString());
requestParm.uid = parms.GetStringValue("uid");
}
#endregion
//根据token 获取uid
return requestParm;
}
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Mall.Model.Extend.User;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using JWT;
using Mall.Common;
using JWT.Algorithms;
using JWT.Serializers;
using Mall.Common.Enum;
namespace Mall.WebApi.Controllers.User
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class TenantController : BaseController
{
private Module.User.TenantModule TenantModule = new Module.User.TenantModule();
// JObject parm = JObject.Parse(RequestParm.msg.ToString());
//UserInfo userInfo = UserReidsCache.GetUserLoginInfo(base.RequestParm.uid);
public ApiResult Login()
{
var query = JsonConvert.DeserializeObject<RB_Tenant_Extend>(RequestParm.msg.ToString());
var model = TenantModule.GetTenantListModule(query).FirstOrDefault();
if (model == null)
{
return ApiResult.Failed("未找到此用户");
}
else
{
if (model.Password != query.Password)
{
return ApiResult.Failed("密码错误");
}
TokenUserInfo userInfo = new TokenUserInfo { uid = model.TenantId.ToString(), requestFrom = ApiRequestFromEnum.Web };
string token = "";
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
var now = provider.GetNow().AddMinutes(-1);
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds);
var payload = new Dictionary<string, object>
{
{"iat",secondsSinceEpoch },
{"exp",secondsSinceEpoch+Config.JwtExpirTime},
{"mall_userInfo",userInfo }
};
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
string secret = Config.JwtSecretKey;
token = encoder.Encode(payload, secret);
#endregion
return ApiResult.Success("", model);
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<NameOfLastUsedPublishProfile>CustomProfile</NameOfLastUsedPublishProfile>
</PropertyGroup>
</Project>
\ No newline at end of file
...@@ -20,7 +20,7 @@ namespace Mall.WebApi ...@@ -20,7 +20,7 @@ namespace Mall.WebApi
Host.CreateDefaultBuilder(args) Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => .ConfigureWebHostDefaults(webBuilder =>
{ {
webBuilder.UseStartup<Startup>(); webBuilder.UseStartup<Startup>().UseIIS();
}); });
} }
} }
<?xml version="1.0" encoding="utf-8"?>
<!--
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<TargetFramework>netcoreapp3.0</TargetFramework>
<ProjectGuid>ad842a33-b1df-4360-ae06-536353f0276c</ProjectGuid>
<SelfContained>false</SelfContained>
<publishUrl>F:\网站发布\Mall.oytour.com</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<_PublishTargetUrl>F:\网站发布\Mall.oytour.com</_PublishTargetUrl>
</PropertyGroup>
</Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment