Commit 5d86f031 authored by 黄奎's avatar 黄奎

页面修改

parent 4189b2a8
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
namespace Mall.Common.Enum
{
......@@ -18,18 +12,17 @@ namespace Mall.Common.Enum
/// </summary>
[EnumField("Web端")]
Web = 1,
/// <summary>
/// 小程序
/// </summary>
[EnumField("小程序")]
MiniProgram = 2,
/// <summary>
/// erp
/// </summary>
[EnumField("erp")]
ERP = 3,
ERP = 3,
}
}
\ No newline at end of file
......@@ -77,6 +77,9 @@ namespace Mall.Module.TradePavilion
{
QActivityIds = activityIds,
QUserIds = userids,
CompanyName=query.CompanyName,
LinkMan=query.LinkMan,
UserId=query.UserId,
});
foreach (var item in userList)
{
......
......@@ -67,6 +67,11 @@ WHERE 1=1
builder.AppendFormat(" AND {0} LIKE @Name ", nameof(RB_Commerce_Consult_Extend.LinkMan));
parameters.Add("Name", "%" + query.LinkMan.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.CompanyName))
{
builder.AppendFormat(" AND {0} LIKE @CompanyName ", nameof(RB_Commerce_Consult_Extend.CompanyName));
parameters.Add("CompanyName", "%" + query.CompanyName.Trim() + "%");
}
if (query.ActivityId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Commerce_Consult_Extend.ActivityId), query.ActivityId);
......@@ -136,6 +141,11 @@ WHERE 1=1
builder.AppendFormat(" AND {0} LIKE @Name ", nameof(RB_Commerce_Consult_Extend.LinkMan));
parameters.Add("Name", "%" + query.LinkMan.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.CompanyName))
{
builder.AppendFormat(" AND {0} LIKE @CompanyName ", nameof(RB_Commerce_Consult_Extend.CompanyName));
parameters.Add("CompanyName", "%" + query.CompanyName.Trim() + "%");
}
if (query.ActivityId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Commerce_Consult_Extend.ActivityId), query.ActivityId);
......
......@@ -108,67 +108,67 @@ namespace Mall.WebApi.Filter
});
}
}
}
#region 签名校验权限校验
if (actionContext.HttpContext.Items[GlobalKey.TokenUserInfo] != null)
{
string openValidation = new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("OpenValidation").Value;
if (openValidation.Equals("True"))
{
string openValidation = new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("OpenValidation").Value;
if (openValidation.Equals("True"))
TokenUserInfo userInfo = JsonConvert.DeserializeObject<TokenUserInfo>(actionContext.HttpContext.Items[GlobalKey.TokenUserInfo].ToString());
if (userInfo != null && (userInfo.requestFrom == Mall.Common.Enum.ApiRequestFromEnum.Web || userInfo.requestFrom == Mall.Common.Enum.ApiRequestFromEnum.MiniProgram))
{
TokenUserInfo userInfo = JsonConvert.DeserializeObject<TokenUserInfo>(actionContext.HttpContext.Items[GlobalKey.TokenUserInfo].ToString());
if (userInfo != null && (userInfo.requestFrom == Mall.Common.Enum.ApiRequestFromEnum.Web || userInfo.requestFrom == Mall.Common.Enum.ApiRequestFromEnum.MiniProgram))
{
SignValidat(actionContext, parm);
}
else
{
#region 权限校验
SignValidat(actionContext, parm);
}
else
{
#region 权限校验
if (userInfo.uid != Config.AdminId)
{
if (userInfo.uid != Config.AdminId)
{
SignValidat(actionContext, parm);
//PermissionValidat(actionContext);
}
#endregion
SignValidat(actionContext, parm);
//PermissionValidat(actionContext);
}
#endregion
}
}
#endregion
}
#endregion
#region 验证表单重复提交
#region 验证表单重复提交
string controllerName = actionContext.ActionDescriptor.RouteValues["controller"].ToString().ToLower();
string actionName = actionContext.ActionDescriptor.RouteValues["action"].ToString().ToLower();
if (!actionName.ToLower().Contains("get"))
string controllerName = actionContext.ActionDescriptor.RouteValues["controller"].ToString().ToLower();
string actionName = actionContext.ActionDescriptor.RouteValues["action"].ToString().ToLower();
if (!actionName.ToLower().Contains("get"))
{
string cachedKey = SecurityHelper.MD5(string.Format("cmd={0}&token={1}", controllerName + "/" + actionName, token));
try
{
string cachedKey = SecurityHelper.MD5(string.Format("cmd={0}&token={1}", controllerName + "/" + actionName, token));
try
if (UserReidsCache.Exists(cachedKey))//判断表单是否重复提交
{
if (UserReidsCache.Exists(cachedKey))//判断表单是否重复提交
{
actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult(new ApiResult
{
resultCode = (int)ResultCode.FormRepeatSubmit,
message = "表单重复提交,请稍后再试",
data = null
});
}
else
actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult(new ApiResult
{
//默认3秒钟之内不能重复提交
UserReidsCache.Set(cachedKey, 1, 3);
}
resultCode = (int)ResultCode.FormRepeatSubmit,
message = "表单重复提交,请稍后再试",
data = null
});
}
catch
else
{
//默认3秒钟之内不能重复提交
UserReidsCache.Set(cachedKey, 1, 3);
}
}
#endregion
catch
{
}
}
#endregion
}
/// <summary>
......@@ -336,7 +336,7 @@ namespace Mall.WebApi.Filter
string privateKey = "";
//等封装了缓存再说
// UserInfo userInfo = UserReidsCache.GetUserLoginInfo(tokenUserInfo.uid);
// UserInfo userInfo = UserReidsCache.GetUserLoginInfo(tokenUserInfo.uid);
//if (userInfo != null)
//{
// privateKey = userInfo.SecretKey;
......@@ -359,62 +359,5 @@ namespace Mall.WebApi.Filter
}
#endregion
}
/// <summary>
/// 权限校验
/// </summary>
/// <param name="actionContext"></param>
private static void PermissionValidat(ActionExecutingContext actionContext)
{
string uid = actionContext.HttpContext.Items[GlobalKey.TokenUserInfo] != null ? JsonConvert.DeserializeObject<TokenUserInfo>(actionContext.HttpContext.Items[GlobalKey.TokenUserInfo].ToString()).uid : "0";
//TODO查询用户权限
string url = actionContext.HttpContext.Request.GetAbsoluteUri();
bool havPermission = true;
//List<object> args = new List<object>() {
// uid
//};
//根据uid 判断用户是否拥有该权限
//Type type = (Type)_obj;
//MethodInfo meth = type.GetMethod(model.Method);
//try
//{
// permission = (string)meth.Invoke(Activator.CreateInstance(type), args.ToArray());
//}
//catch
//{
//}
//if (!string.IsNullOrWhiteSpace(permission))
//{
// if (permission.ToLower().Contains(url.ToLower()))
// {
// havPermission = true;
// }
// else//判断菜单是否存在
// {
// bool systemIsExit = RbUserCache.GetSystemHasMenu(url.ToLower());
// if (!systemIsExit)
// {
// havPermission = true;
// }
// }
//}
if (havPermission == false)
{
actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult(
new ApiResult
{
resultCode = (int)ResultCode.NoPermission,
message = "权限不足",
data = null
});
}
}
}
}
\ No newline at end of file
using JWT;
using JWT.Serializers;
using Mall.Common.API;
using Mall.Common.Plugin;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mall.WebApi.Helper
{
/// <summary>
/// Token帮助类
/// </summary>
public class TokenHelper
{
/// <summary>
/// 生成Token
/// </summary>
/// <returns></returns>
public static string CreateToken()
{
return "";
}
/// <summary>
/// 解析Token
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public static TokenUserInfo ParsingToken(string token)
{
TokenUserInfo tokenUser = new TokenUserInfo();
if (string.IsNullOrEmpty(token))
{
IJsonSerializer serializer = new JsonNetSerializer();
IDateTimeProvider provider = new UtcDateTimeProvider();
IJwtValidator validator = new JwtValidator(serializer, provider);
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtDecoder decoder = new JwtDecoder(serializer, validator, urlEncoder);
string secret = Common.Config.JwtSecretKey;
var json = decoder.Decode(token, secret, verify: true);//token为之前生成的字符串
if (!string.IsNullOrEmpty(json))
{
JObject jwtJson = JObject.Parse(json);
var mall_userInfo = JObject.Parse(jwtJson.GetStringValue("mall_userInfo"));
tokenUser.requestFrom = (Common.Enum.ApiRequestFromEnum)mall_userInfo.GetInt("requestFrom");
tokenUser.uid = mall_userInfo.GetStringValue("uid");
}
}
return tokenUser;
}
}
}
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