Himall.Web.Framework/ShopOperationLogAttribute.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Himall.Core.Helper;
using Himall.IServices;
using Himall.Model;
using Himall.ServiceProvider;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using System.Web.Routing;

namespace Himall.Web.Framework
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
	public class ShopOperationLogAttribute : ActionFilterAttribute
	{
		public string Message
		{
			get;
			set;
		}

		public string ParameterNameList
		{
			get;
			set;
		}

		public ShopOperationLogAttribute(string message, string parameterNameList = "")
		{
            Message = message;
            ParameterNameList = parameterNameList;
		}

		public ShopOperationLogAttribute()
		{
		}

		public override void OnResultExecuted(ResultExecutedContext filterContext)
		{
			string str = filterContext.RouteData.Values["controller"].ToString();
			string str1 = filterContext.RouteData.Values["action"].ToString();
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(string.Concat(Message, ",操作记录:"));
			if (!string.IsNullOrEmpty(ParameterNameList))
			{
				Dictionary<string, string> strs = new Dictionary<string, string>();
				string parameterNameList = ParameterNameList;
				char[] chrArray = new char[] { ',', '|' };
				string[] strArrays = parameterNameList.Split(chrArray);
				for (int i = 0; i < strArrays.Length; i++)
				{
					string str2 = strArrays[i];
					ValueProviderResult value = filterContext.Controller.ValueProvider.GetValue(str2);
					if (value != null && !strs.ContainsKey(str2))
					{
						strs.Add(str2, value.AttemptedValue);
					}
				}
后面还有 19 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。