/// <summary> /// 获取 互帮互助 列表(只包含标题) /// </summary> /// <param name="pageNo">页号(大于0)</param> /// <param name="pageSize">每页大小(小于20)</param> /// <returns></returns> public string GetPostTitlesByPage(int pageNo, int pageSize) { try { var result = _interactPostLogic.LoadPostListByPage(pageNo, pageSize).ToList(); PostDataSpanTypes = _globalTypeConfigLogic.FindTypeByCategory(POST_SPAN_CATEGORY).ToList(); return(new ResultFormat(1, from it in result select new { Id = it.post_id, Title = it.title, Keyword = it.keyword, Contact = it.contact_info, ReleaseTime = it.release_time, Member = it.member_name, DateSpan = PostDataSpanTypes.Where(span => it.data_span.HasValue && span.type_id == it.data_span).Select(type => type.type_name).FirstOrDefault() } ).ToString()); } catch (Exception ex) { LogHelper.GetInstance().Error(ex.ToString()); return(new ResultFormat(0, ex.Message).ToString()); } }
/// <summary> /// 根据id获取指定的互帮互助 /// </summary> /// <param name="postId"></param> /// <returns></returns> public string GetSpecialInteractPost(long postId) { try { var result = _interactPostLogic.Find(it => it.post_id == postId).FirstOrDefault(); if (result != null) { PostDataSpanTypes = _globalTypeConfigLogic.FindTypeByCategory(POST_SPAN_CATEGORY).ToList(); return(new ResultFormat(1, new { Id = result.post_id, Title = result.title, Keyword = result.keyword, Contact = result.contact_info, ReleaseTime = result.release_time, Content = result.content, DateSpan = PostDataSpanTypes.Where(span => result.data_span.HasValue && span.type_id == result.data_span).Select(type => type.type_name).FirstOrDefault() } ).ToString()); } return(new ResultFormat(0, string.Empty).ToString()); } catch (Exception ex) { LogHelper.GetInstance().Error(ex.ToString()); return(new ResultFormat(0, ex.Message).ToString()); } }