Esempio n. 1
0
        public IActionResult SearchArtice(string uuid, [FromBody] JObject fromValue)
        {
            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;
                bool   verifyParams = IsSearchArticeParams(fromValue);
                string keyword      = GetJObjectValue(fromValue, "keyword");
                string memberId     = GetJObjectValue(fromValue, "memberid");
                string clientId     = GetJObjectValue(fromValue, "clientid");
                if (string.IsNullOrWhiteSpace(keyword))
                {
                    return(Error("关建字不能为空!"));
                }
                int  total      = 200;
                bool saveResult = SaveSearchKeyword(companyId, memberId, clientId.ToInt(), keyword);
                var  lists      = ArticeService.SearchArtice(SystemID, companyId, keyword, total);
                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", data));
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
        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));
            }
        }