小程序接口、培训计划界面调优

This commit is contained in:
2025-03-05 17:00:55 +08:00
parent e975ddbf1d
commit 02ba872cee
20 changed files with 422 additions and 1637 deletions
+30 -30
View File
@@ -75,41 +75,41 @@ namespace WebAPI.Filter
//}
//&& !System.Web.HttpContext.Current.User.Identity.IsAuthenticated
if (isOk && lists.FirstOrDefault(x => x == strValues) == null && actionContext.ActionDescriptor.ControllerDescriptor.ControllerName != "FileUpload")
{
isOk = false;
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
new { code = "0", message = "登录超出,请重新登录!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
//if (isOk && lists.FirstOrDefault(x => x == strValues) == null && actionContext.ActionDescriptor.ControllerDescriptor.ControllerName != "FileUpload")
//{
// isOk = false;
// actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
// new { code = "0", message = "登录超出,请重新登录!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
}
//}
//base.OnActionExecuting(actionContext);
if (isOk)
{
if (!isWithOut)
{
// 在调用 Action 方法之前执行的代码,可获取请求的接口名称和参数
IDictionary<string, object> arguments = actionContext.ActionArguments; // 获取参数
foreach (KeyValuePair<string, object> item in arguments)
{
if (item.Key.ToLower() == "projectid")
{
var ProjectItems = APIProjectService.geProjectsByUserId(token.FirstOrDefault());
List<string> projects = new List<string>();
if (ProjectItems.Count > 0)
{
projects = ProjectItems.Select(x => x.ProjectId).ToList();
}
if (item.Value != null && !projects.Contains(item.Value.ToString()))
{
//if (!isWithOut)
//{
// // 在调用 Action 方法之前执行的代码,可获取请求的接口名称和参数
// IDictionary<string, object> arguments = actionContext.ActionArguments; // 获取参数
// foreach (KeyValuePair<string, object> item in arguments)
// {
// if (item.Key.ToLower() == "projectid")
// {
// var ProjectItems = APIProjectService.geProjectsByUserId(token.FirstOrDefault());
// List<string> projects = new List<string>();
// if (ProjectItems.Count > 0)
// {
// projects = ProjectItems.Select(x => x.ProjectId).ToList();
// }
// if (item.Value != null && !projects.Contains(item.Value.ToString()))
// {
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
new { code = "0", message = "您没有该项目权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
return;
}
}
}
}
// actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
// new { code = "0", message = "您没有该项目权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
// return;
// }
// }
// }
//}
base.OnActionExecuting(actionContext);
}
else
@@ -120,7 +120,7 @@ namespace WebAPI.Filter
}
/// <summary>
///
/// 授权接口
/// </summary>
public static List<string> lists = new List<string>
{