public async Task AddError(OperatorLogEntity item)
        {
            item.IsSuccess  = false;
            item.Ip         = _httpAccessor.HttpContext.GetUserIp();
            item.AdminName  = item.AdminName ?? _httpAccessor.HttpContext.User.Identity.Name;
            item.CreateDate = DateTime.Now;

            await _logRepository.Add(item);
        }
Exemple #2
0
        /// <summary>
        /// 记录日志
        /// </summary>
        public async Task SaveLog(string userId, int clientId, string loginIp, UserLoginModel loginModel)
        {
            var logEntity = new OperatorLogEntity
            {
                UserId     = userId,
                Content    = loginModel.ToString(),
                Ip         = loginIp,
                CreateDate = DateTime.Now,
                ClientId   = clientId
            };
            await _operatorLogRepository.InsertAsync(logEntity);

            await _unitOfWork.SaveChangesAsync();
        }