Пример #1
0
        public IActionResult GetAdminCPLogList(string keyword, int page = 1, int limit = 20)
        {
            int numPerPage, currentPage, startRowIndex;

            numPerPage    = limit;
            currentPage   = page;
            startRowIndex = (currentPage - 1) * numPerPage;
            Expression ex = AdminLog._.Id > 0;

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                if (Utils.IsInt(keyword))
                {
                    ex &= (AdminLog._.Id == int.Parse(keyword) | AdminLog._.UserName.Contains(keyword));
                }
                else
                {
                    ex &= AdminLog._.UserName.Contains(keyword);
                }
            }
            string kid = Request.Query["kid"];
            //if (Utils.IsInt(kid) && int.Parse(kid) > 0)
            //{
            //    ex &= AdminLog._.KId == int.Parse(kid);
            //}
            IList <AdminLog> list       = AdminLog.FindAll(ex, AdminLog._.Id.Desc(), null, startRowIndex, numPerPage);
            long             totalCount = AdminLog.FindCount(ex, AdminLog._.Id.Desc(), null, startRowIndex, numPerPage);

            Core.Admin.WriteLogActions("后台管理日志留言列表(page:" + page + ");");
            return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain"));
        }