Ejemplo n.º 1
0
        public override InfoLogModel GetLog(ActionExecutingContext context)
        {
            _logService     = (ILogService)HttpContext.RequestServices.GetService(typeof(ILogService));
            _projectSetting = (IOptions <ProjectSetting>)HttpContext.RequestServices.GetService(typeof(IOptions <ProjectSetting>));
            var logModel = base.GetLog(context);

            if (logModel != null)
            {
                logModel.SystemName = _projectSetting.Value.SystemName;
                //TODO 写日志
                InfoLogDto logDto = new InfoLogDto()
                {
                    SystemName     = logModel.SystemName,
                    ActionName     = logModel.ActionName,
                    ControllerName = logModel.ControllerName,
                    HttpStatusCode = logModel.HttpStatusCode,
                    IPAddress      = logModel.IpAddress,
                    UserID         = logModel.UserID,
                    LoginName      = logModel.LoginName,
                    Method         = logModel.Method,
                    Parameter      = logModel.Parameter,
                    Url            = logModel.Url,
                    OperateTime    = logModel.OperateTime
                };
                _logService.WriteInfoLog(logDto);
                Core.Service.LogService.Info(logDto.Url + (string.IsNullOrEmpty(logDto.Parameter) ? "" : ("?" + logDto.Parameter)));
            }
            return(logModel);
        }
Ejemplo n.º 2
0
        public ServiceReturnDto WriteInfoLog(InfoLogDto log)
        {
            Sys_Info_Log entity = new Sys_Info_Log()
            {
                ActionName     = log.ActionName,
                ControllerName = log.ControllerName,
                HttpStatusCode = log.HttpStatusCode,
                HttpType       = log.Method,
                IPAddress      = log.IPAddress,
                UserID         = log.UserID,
                LoginName      = log.LoginName,
                Parameters     = log.Parameter,
                URL            = log.Url,
                SystemName     = log.SystemName,
                OperateTime    = log.OperateTime
            };

            _unitOfWork.SysInfoLogRep.Insert(entity);
            return(null);
        }