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

页面修改

parent 88ca24ce
using System;
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -7,6 +8,8 @@ namespace Mall.Model.Entity.User
/// <summary>
/// 商户信息表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Tenant
{
/// <summary>
......
using System;
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -7,6 +8,8 @@ namespace Mall.Model.Extend.User
/// <summary>
/// 商户信息表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Tenant_Extend : Model.Entity.User.RB_Tenant
{
......
......@@ -13,4 +13,8 @@
<PackageReference Include="MongoDB.Bson" Version="2.10.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
</ItemGroup>
</Project>
......@@ -20,6 +20,7 @@ namespace Mall.Repository.User
public List<RB_Tenant_Extend> GetListRepository(RB_Tenant_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(" SELECT * FROM RB_Tenant WHERE 1=1 ");
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
parm = DoApiMonitorLog(actionContext, ref token);
#endregion
var notValidat = parm["cmd"].ToString();
#region Token校验
JWTValidat(actionContext, token);
if (notValidat != "/api/Tenant/Login")
{
JWTValidat(actionContext, token);
}
#endregion
#region 签名校验权限校验
......@@ -121,32 +127,32 @@ namespace Mall.WebApi.Filter
/// <returns></returns>
private JObject DoApiMonitorLog(ActionExecutingContext actionContext, ref string token)
{
JObject parm = new JObject();
JObject parm = new JObject();
var request = actionContext.HttpContext.Request;
#region 如果参数是json实体对象,获取序列化后的数据
request.EnableBuffering();//重置读取
request.Body.Seek(0, SeekOrigin.Begin);
request.Body.Position = 0;
Stream stream = request.Body;
Encoding encoding = Encoding.UTF8;
byte[] buffer = new byte[request.ContentLength.Value];
stream.Read(buffer, 0, buffer.Length);
string responseData = Encoding.UTF8.GetString(buffer);
if (!string.IsNullOrWhiteSpace(responseData.Trim()))
Encoding encoding = Encoding.UTF8;
if (request.ContentLength > 0)
{
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()))
{
parm = JObject.Parse(responseData);
actionContext.HttpContext.Items[GlobalKey.UserPostInfo] = responseData;
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("DoApiMonitorLog:{0}", responseData));
try
{
parm = JObject.Parse(responseData);
actionContext.HttpContext.Items[GlobalKey.UserPostInfo] = responseData;
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("DoApiMonitorLog:{0}", responseData));
}
token = JsonHelper.GetStringValue(parm, "token");
}
token = JsonHelper.GetStringValue(parm, "token");
}
#endregion
return parm;
......
......@@ -14,6 +14,7 @@
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.DataHelper\Mall.DataHelper.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Module.User\Mall.Module.User.csproj" />
<ProjectReference Include="..\Mall.ThirdCore\Mall.ThirdCore.csproj" />
</ItemGroup>
......
......@@ -29,52 +29,23 @@ namespace Mall.WebApi
// This method gets called by the runtime. Use this method to add services to the container.
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)
.Configure<IISServerOptions>(x => x.AllowSynchronousIO = true);
services.AddControllers();
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 =>
{
options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All);
options.JsonSerializerOptions.PropertyNamingPolicy = null;
});
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"})));
//services.AddCors(options =>
//{
// options.AddPolicy("AllowCors",
// builder =>
// {
// builder.WithOrigins("http://www.test.com:8080")
// .SetIsOriginAllowedToAllowWildcardSubdomains()
// .AllowAnyHeader()
// .AllowAnyMethod()
// .AllowCredentials();
// });
//});
List<string> corsArray = new List<string>()
{
"http://localhost:8081",
"http://localhost:8080"
};
services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray())));
}
// 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": {
"DefaultConnection": "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_user;CharSet=utf8; Convert Zero Datetime=true; ",
"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"
"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"
},
"Logging": {
"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