public JsonResult Search(int pageIndex = 1, int pageSize = 10) { try { var total = 0; var userName = _ssoUser.GetUserIdentity(); var data = _projectRepository.Search(userName, pageIndex, pageSize, ref total); return(Json(new { success = true, data, total })); } catch (Exception ex) { return(Json(new { success = false, msg = ex.ToString() })); } }
public JsonResult SearchLogList(List <string> logDateRange, int pageIndex = 1, int pageSize = 10) { try { var total = 0; var endDate = DateTime.Now; var startDate = endDate.AddDays(-30); if (logDateRange != null && logDateRange.Count > 1) { DateTime.TryParse(logDateRange[0].Substring(0, 24), out startDate); DateTime.TryParse(logDateRange[1].Substring(0, 24), out endDate); } var role = "none"; var userName = _ssoUser.GetUserIdentity(); if (userName.ToLower() == "sys") { role = "admin";// to do, this haven't done yet } if (startDate == endDate) { endDate = endDate.AddDays(1); } var data = _logRepository.Search(startDate, endDate, role, userName, pageIndex, pageSize, ref total); return(Json(new { success = true, data, total })); } catch (Exception ex) { _logger.LogError("查询操作日志错误:" + ex.ToString()); return(Json(new { success = false, msg = ex.ToString() })); } }
public JsonResult SearchEngineDataList(string dataName, int pageIndex = 1, int pageSize = 10) { try { if (string.IsNullOrEmpty(dataName)) { dataName = ""; } var total = 0; var userName = _ssoUser.GetUserIdentity(); var data = _dataSetRepository.SearchEngineDataList(userName, dataName, pageIndex, pageSize, ref total); return(Json(new { success = true, data, total })); } catch (Exception ex) { return(Json(new { success = false, msg = ex.ToString() })); } }
public void Add(string action, string projectName = "", string sourceName = "",string message = "") { try { LogModel actionLog = new LogModel(); actionLog.DtDate = DateTime.Now; actionLog.Level = "INFO"; actionLog.Account = _ssoUser.GetUserIdentity(); actionLog.Message = message; actionLog.ClientIp = _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(); actionLog.ProjectName = projectName; actionLog.SourceName = sourceName; actionLog.Action = action; actionLog.Thread = Thread.CurrentThread.ManagedThreadId.ToString("00"); int count = _dbKyStatic.Insertable(actionLog).ExecuteCommand(); } catch (Exception ex) { _logger.LogError("记录操作日志失败:" + ex.ToString()); } }