public IActionResult List()
        {
            try
            {
                string funcId = PermissionEnum.CodeFormat((int)PermissionEnum.内容管理.资讯管理.列表);
                if (!IsPermission(funcId))
                {
                    return(ToPermission(funcId));
                }

                string startTime = GetQueryString("datemin");
                string endTime   = GetQueryString("datemax");
                string state     = GetQueryString("state");
                string keyword   = GetQueryString("keyword");
                ViewData["DateMin"] = startTime;
                ViewData["DateMax"] = endTime;
                ViewData["State"]   = state;
                ViewData["Keyword"] = keyword;

                string classId = "";
                bool   delete  = false;
                int    total   = 100;
                List <Ld_Info_Artice> lists = new List <Ld_Info_Artice>();
                string strKeyword           = string.Format("{0}{1}", startTime, keyword);
                if (string.IsNullOrWhiteSpace(strKeyword))
                {
                    lists = ArticeService.GetArticeTop(SystemID, CompanyID, delete, total);
                }
                else
                {
                    lists = ArticeService.SearchArtice(SystemID, CompanyID, startTime, endTime, classId, state, keyword, delete);
                }
                ViewData["Count"] = ArticeService.CountArtice(SystemID, CompanyID, delete);
                return(View(lists));
            }
            catch (Exception ex)
            {
                return(ToError(ex.Message));
            }
        }
Example #2
0
        public IActionResult GetArticePaging(string uuid)
        {
            long logId = 0;

            try
            {
                logId = BaseApiManager.SaveLogs(uuid);
                if (!IsUuid(uuid))
                {
                    return(Error(logId, "verify uuid fail!"));
                }
                var    entityInterfaceAccount = GetInterfaceAccountByUuid(uuid);
                string companyId = entityInterfaceAccount.CompanyID;
                string classId   = Accessor.HttpContext.Request.GetQueryString("classid");
                int    pageIndex = Utility.ToPageIndex(Accessor.HttpContext.Request.GetQueryString("page").ToInt());
                int    pageCount = Utility.ToPageCount(Accessor.HttpContext.Request.GetQueryString("count").ToInt());
                string state     = "true";
                bool   delete    = false;
                long   total     = ArticeService.CountArtice(SystemID, companyId, classId, state, delete);
                var    lists     = ArticeService.GetArticePaging(SystemID, companyId, classId, state, delete, pageIndex, pageCount);
                if (lists == null)
                {
                    return(Error("not data!"));
                }
                var data = from m in lists
                           select new
                {
                    id          = m.ArticeID,
                    title       = m.Title.IIF(),
                    title_brief = m.TitleBrief.IIF(),
                    class_id    = m.ClassID,
                    class_name  = m.ClassName,
                    author      = m.Author.IIF(),
                    source      = m.Source.IIF(),
                    image_src   = m.ImgSrc.IIF(),
                    hits        = m.Hits.ToInt(),
                    digs_up     = m.UpNum.ToInt(),
                    digs_down   = m.DownNum.ToInt(),
                    keyword     = m.Keyword.IIF(),
                    description = m.Description.IIF(),
                    date        = m.CreateDate
                };
                return(Success(logId, "ok", new { page = pageIndex, total, rows = data }));
            }
            catch (Exception ex)
            {
                return(Error(logId, ex.Message));
            }
        }