/// <summary>
        /// 日志列表页
        /// </summary>
        /// <returns></returns>
        public IActionResult Index(string keyword, int pageIndex = 1, int operId = -1)
        {
            var    pageSize    = 10;
            var    pageKeyword = keyword;
            var    totalCount  = 0;
            var    pageList    = _db.GetSystemLogDbList(pageIndex, pageSize, out totalCount, pageKeyword, operId);
            string url         = "/log/index?keyword=" + pageKeyword + "&openId=" + operId + "&pageIndex={__id__}";

            ViewData["pageIndex"]  = pageIndex;
            ViewData["pageSize"]   = pageSize;
            ViewData["totalCount"] = totalCount;
            ViewData["pageUrl"]    = url;
            ViewData["centSize"]   = 5;
            List <dynamic> dyList = new List <dynamic>();

            foreach (var item in pageList)
            {
                var id         = item.LogId;
                var oper       = ((EnumLog.Log)Enum.Parse(typeof(EnumLog.Log), item.LogOperId.ToString())).GetDisplayName();
                var actionName = item.LogActionName;
                var respone    = ((EnumLog.Respone)Enum.Parse(typeof(EnumLog.Respone), item.LogResponeType.ToString())).GetDisplayName();
                var time       = item.LogDateTime.ToString("yyyy-MM-dd HH:mm:ss");
                dyList.Add(new { id, oper, actionName, respone, time });
            }
            var pageJson = Utils.Json.JsonUnits.ConvertJsonString(Utils.Json.JsonUnits.ToJSON(dyList));

            ViewData["ContextPageList"] = pageJson;
            return(View());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <returns></returns>
        public HttpInvokeResultModel GetResultModel(string keyword, int pageIndex = 1, int operId = -1)
        {
            var pageSize   = 50;
            var totalCount = 0;
            var jsonList   = _db.GetSystemLogDbList(pageIndex, pageSize, out totalCount, keyword, operId);

            if (jsonList.Count == 0)
            {
                var errorModel = JsonResultHandle.Error("对不起,没有更多数据啦");
                return(errorModel);
            }
            //获取总页数
            int            total_page = totalCount % (pageSize - 0) == 0 ? totalCount / (pageSize - 0) : totalCount / (pageSize - 0) + 1;
            List <dynamic> dyList     = new List <dynamic>();
            dynamic        dynamicModel;

            foreach (var item in jsonList)
            {
                var id         = item.LogId;
                var oper       = ((EnumLog.Log)Enum.Parse(typeof(EnumLog.Log), item.LogOperId.ToString())).GetDisplayName();
                var actionName = item.LogActionName;
                var respone    = ((EnumLog.Respone)Enum.Parse(typeof(EnumLog.Respone), item.LogResponeType.ToString())).GetDisplayName();
                var time       = item.LogDateTime.ToString("yyyy-MM-dd HH:mm:ss");
                dyList.Add(new { id, oper, actionName, respone, time });
            }
            dynamicModel = new { total_page, dyList };
            var returnModle = JsonResultHandle.Success("返回成功", dynamicModel);

            return(returnModle);
        }