Cat.Web/Cat.Admin.Web/Controllers/BaseController.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Newtonsoft.Json;
using Cat.Util.Extension;
using Cat.Util.Model;
using Cat.Util;
using System.Diagnostics;
using Cat.Entity.SystemManage;
using System.Reflection;
using System.Text;
using Cat.Web.Code;
using Cat.Business.SystemManage;
using Cat.Enum;
namespace Cat.Admin.Web.Controllers
{
/// <summary>
/// 基础控制器,用来记录访问日志
/// </summary>
public class BaseController : Controller
{
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
Stopwatch sw = new Stopwatch();
sw.Start();
string action = context.RouteData.Values["Action"].ParseToString();
OperatorInfo user = await Operator.Instance.Current();
if (GlobalContext.SystemConfig.Demo)
{
if (context.HttpContext.Request.Method.ToUpper() == "POST")
{
string[] allowAction = new string[] { "LoginJson", "ExportUserJson", "CodePreviewJson" };
if (!allowAction.Select(p => p.ToUpper()).Contains(action.ToUpper()))
{
TData obj = new TData();
obj.Message = "演示模式,不允许操作";
context.Result = new JsonResult(obj);
return;
}
}
}
var resultContext = await next();
sw.Stop();
string ip = NetHelper.Ip;
LogOperateEntity operateEntity = new LogOperateEntity();
var areaName = context.RouteData.DataTokens["area"] + "/";
var controllerName = context.RouteData.Values["controller"] + "/";
string currentUrl = "/" + areaName + controllerName + action;
string[] notLogAction = new string[] { "GetServerJson", "Error" };
if (!notLogAction.Select(p => p.ToUpper()).Contains(action.ToUpper()))
{
后面还有 72 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。