You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

91 line
2.9 KiB

  1. using Learun.Application.AppMagager;
  2. using Learun.Util;
  3. using Nancy;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using Learun.Application.Base.SystemModule;
  7. using Learun.Application.TwoDevelopment.LR_Desktop;
  8. using System.Text;
  9. using System.Data;
  10. using Learun.Application.OA;
  11. namespace Learun.Application.WebApi.Modules
  12. {
  13. public class NewsApi : BaseApi
  14. {
  15. private NoticeIBLL noticeIBLL = new NoticeBLL();
  16. public NewsApi()
  17. : base("/learun/news")
  18. {
  19. Get["/list"] = GetList;
  20. }
  21. /// <summary>
  22. /// 获取页面显示列表数据
  23. /// <summary>
  24. /// <param name="_"></param>
  25. /// <returns></returns>
  26. public Response GetList(dynamic _)
  27. {
  28. var userinfo = LoginUserInfo.Get();
  29. Pagination paginationobj = new Pagination();
  30. var newsList = noticeIBLL.GetList("", userinfo.userId,(Request.Query["F_CategoryId"]!=null?Request.Query["F_CategoryId"].ToString():""));
  31. var newsListOfSelf = new List<NewsEntity>();
  32. foreach (var newsitemEntity in newsList)
  33. {
  34. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  35. {
  36. if (!string.IsNullOrEmpty(userinfo.postIds))
  37. {
  38. if (userinfo.postIds.Contains(","))
  39. {
  40. foreach (var postid in userinfo.postIds.Split(','))
  41. {
  42. if (newsitemEntity.F_SendPostId.Contains(postid))
  43. {
  44. newsListOfSelf.Add(newsitemEntity);
  45. break;
  46. }
  47. }
  48. }
  49. else
  50. {
  51. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  52. {
  53. newsListOfSelf.Add(newsitemEntity);
  54. }
  55. }
  56. }
  57. }
  58. else
  59. {
  60. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  61. {
  62. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  63. {
  64. newsListOfSelf.Add(newsitemEntity);
  65. }
  66. }
  67. else
  68. {
  69. newsListOfSelf.Add(newsitemEntity);
  70. }
  71. }
  72. }
  73. var jsonData = new
  74. {
  75. rows = newsListOfSelf,
  76. total = newsListOfSelf.Count,
  77. page = 0,
  78. records = newsListOfSelf.Count
  79. };
  80. return Success(jsonData);
  81. }
  82. }
  83. }