Commit 37e8ef1c authored by 黄奎's avatar 黄奎

页面修改

parent 88ca24ce
using System; using Mall.Common.AOP;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
...@@ -7,6 +8,8 @@ namespace Mall.Model.Entity.User ...@@ -7,6 +8,8 @@ namespace Mall.Model.Entity.User
/// <summary> /// <summary>
/// 商户信息表实体 /// 商户信息表实体
/// </summary> /// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Tenant public class RB_Tenant
{ {
/// <summary> /// <summary>
......
using System; using Mall.Common.AOP;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
...@@ -7,6 +8,8 @@ namespace Mall.Model.Extend.User ...@@ -7,6 +8,8 @@ namespace Mall.Model.Extend.User
/// <summary> /// <summary>
/// 商户信息表扩展实体 /// 商户信息表扩展实体
/// </summary> /// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Tenant_Extend : Model.Entity.User.RB_Tenant public class RB_Tenant_Extend : Model.Entity.User.RB_Tenant
{ {
......
...@@ -13,4 +13,8 @@ ...@@ -13,4 +13,8 @@
<PackageReference Include="MongoDB.Bson" Version="2.10.3" /> <PackageReference Include="MongoDB.Bson" Version="2.10.3" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
</ItemGroup>
</Project> </Project>
...@@ -20,6 +20,7 @@ namespace Mall.Repository.User ...@@ -20,6 +20,7 @@ namespace Mall.Repository.User
public List<RB_Tenant_Extend> GetListRepository(RB_Tenant_Extend query) public List<RB_Tenant_Extend> GetListRepository(RB_Tenant_Extend query)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.Append(" SELECT * FROM RB_Tenant WHERE 1=1 ");
return Get<RB_Tenant_Extend>(builder.ToString()).ToList(); return Get<RB_Tenant_Extend>(builder.ToString()).ToList();
} }
......
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 PApiController : ControllerBase
{
/// <summary>
/// 整理前端传递的post参数
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
public RequestParm GetRequestParm()
{
#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 Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace Mall.WebApi.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}
...@@ -40,8 +40,14 @@ namespace Mall.WebApi.Filter ...@@ -40,8 +40,14 @@ namespace Mall.WebApi.Filter
parm = DoApiMonitorLog(actionContext, ref token); parm = DoApiMonitorLog(actionContext, ref token);
#endregion #endregion
var notValidat = parm["cmd"].ToString();
#region Token校验 #region Token校验
JWTValidat(actionContext, token);
if (notValidat != "/api/Tenant/Login")
{
JWTValidat(actionContext, token);
}
#endregion #endregion
#region 签名校验权限校验 #region 签名校验权限校验
...@@ -121,32 +127,32 @@ namespace Mall.WebApi.Filter ...@@ -121,32 +127,32 @@ namespace Mall.WebApi.Filter
/// <returns></returns> /// <returns></returns>
private JObject DoApiMonitorLog(ActionExecutingContext actionContext, ref string token) private JObject DoApiMonitorLog(ActionExecutingContext actionContext, ref string token)
{ {
JObject parm = new JObject(); JObject parm = new JObject();
var request = actionContext.HttpContext.Request; var request = actionContext.HttpContext.Request;
#region 如果参数是json实体对象,获取序列化后的数据 #region 如果参数是json实体对象,获取序列化后的数据
request.EnableBuffering();//重置读取 request.EnableBuffering();//重置读取
request.Body.Seek(0, SeekOrigin.Begin); request.Body.Seek(0, SeekOrigin.Begin);
request.Body.Position = 0; request.Body.Position = 0;
Stream stream = request.Body; Stream stream = request.Body;
Encoding encoding = Encoding.UTF8; Encoding encoding = Encoding.UTF8;
byte[] buffer = new byte[request.ContentLength.Value]; if (request.ContentLength > 0)
stream.Read(buffer, 0, buffer.Length);
string responseData = Encoding.UTF8.GetString(buffer);
if (!string.IsNullOrWhiteSpace(responseData.Trim()))
{ {
try byte[] buffer = new byte[request.ContentLength.Value];
stream.Read(buffer, 0, buffer.Length);
string responseData = Encoding.UTF8.GetString(buffer);
if (!string.IsNullOrWhiteSpace(responseData.Trim()))
{ {
try
parm = JObject.Parse(responseData); {
actionContext.HttpContext.Items[GlobalKey.UserPostInfo] = responseData; parm = JObject.Parse(responseData);
} actionContext.HttpContext.Items[GlobalKey.UserPostInfo] = responseData;
catch (Exception ex) }
{ catch (Exception ex)
LogHelper.Write(ex, string.Format("DoApiMonitorLog:{0}", responseData)); {
LogHelper.Write(ex, string.Format("DoApiMonitorLog:{0}", responseData));
}
token = JsonHelper.GetStringValue(parm, "token");
} }
token = JsonHelper.GetStringValue(parm, "token");
} }
#endregion #endregion
return parm; return parm;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" /> <ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.DataHelper\Mall.DataHelper.csproj" /> <ProjectReference Include="..\Mall.DataHelper\Mall.DataHelper.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" /> <ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Module.User\Mall.Module.User.csproj" />
<ProjectReference Include="..\Mall.ThirdCore\Mall.ThirdCore.csproj" /> <ProjectReference Include="..\Mall.ThirdCore\Mall.ThirdCore.csproj" />
</ItemGroup> </ItemGroup>
......
...@@ -29,52 +29,23 @@ namespace Mall.WebApi ...@@ -29,52 +29,23 @@ namespace Mall.WebApi
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
//services.Configure<Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions>(options =>
//{
// options.AllowSynchronousIO = true;
//});
services.Configure<Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions>(x => x.AllowSynchronousIO = true) services.Configure<Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions>(x => x.AllowSynchronousIO = true)
.Configure<IISServerOptions>(x => x.AllowSynchronousIO = true); .Configure<IISServerOptions>(x => x.AllowSynchronousIO = true);
services.AddControllers(); services.AddControllers();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); //注入http上下文 services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); //注入http上下文
//注入 Quartz调度类
//services.AddSingleton<QuartzHelper>();
//services.AddTransient<TimingHelper>(); // 这里使用瞬时依赖注入
// services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();//注册ISchedulerFactory的实例。
//任务调度
//services.AddMvc().AddNewtonsoftJson(options =>
//{
// // 忽略循环引用
// options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
// // 不使用驼峰
// options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();//json字符串大小写原样输出
// // 设置时间格式
// options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
// // 如字段为null值,该字段不会返回到前端
// // options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
// options.SerializerSettings.Converters.
//});
//services.AddSingleton<IJobFactory, IOCJobFactory>();
services.AddMvc().AddJsonOptions(options => services.AddMvc().AddJsonOptions(options =>
{ {
options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All);
options.JsonSerializerOptions.PropertyNamingPolicy = null; options.JsonSerializerOptions.PropertyNamingPolicy = null;
}); });
List<string> corsArray = new List<string>()
services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(new[] {
{ "http://www.test.com:8080", "http://www.test.com:8081", "http://localhost:63342","http://localhost:59823","http://www.test.com:8082","http://activity.oytour.com","https://activity.oytour.com", "http://crmyx.oytour.com:8080","http://crmyx.oytour.com","http://fcrmyx.oytour.com", "http://yx.oytour.com","http://testerp.oytour.com:8080"}))); "http://localhost:8081",
//services.AddCors(options => "http://localhost:8080"
//{ };
// options.AddPolicy("AllowCors", services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray())));
// builder =>
// {
// builder.WithOrigins("http://www.test.com:8080")
// .SetIsOriginAllowedToAllowWildcardSubdomains()
// .AllowAnyHeader()
// .AllowAnyMethod()
// .AllowCredentials();
// });
//});
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
using System;
namespace Mall.WebApi
{
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; }
}
}
{ {
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_user;CharSet=utf8; Convert Zero Datetime=true; ", "DefaultConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_mall;CharSet=utf8; Convert Zero Datetime=true; ",
"DefaultConnectionPName": "MySql.Data.MySqlClient", "DefaultConnectionPName": "MySql.Data.MySqlClient"
"SellConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_sell;CharSet=utf8; Convert Zero Datetime=true; ",
"SellConnectionPName": "MySql.Data.MySqlClient",
"FinanceConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8; Convert Zero Datetime=true; ",
"FinanceConnectionPName": "MySql.Data.MySqlClient",
"LogConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_log;CharSet=utf8; Convert Zero Datetime=true; ",
"LogConnectionPName": "MySql.Data.MySqlClient",
"DmcConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_dmc;CharSet=utf8; Convert Zero Datetime=true; ",
"DmcConnectionPName": "MySql.Data.MySqlClient"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
......
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