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.
 
 
 
 
 
 

110 lines
3.5 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. Get["/shList"] = GetshList;
  21. }
  22. /// <summary>
  23. /// 获取页面显示列表数据
  24. /// <summary>
  25. /// <param name="_"></param>
  26. /// <returns></returns>
  27. public Response GetList(dynamic _)
  28. {
  29. var userinfo = LoginUserInfo.Get();
  30. Pagination paginationobj = new Pagination();
  31. var newsList = noticeIBLL.GetList("", userinfo.userId,(Request.Query["F_CategoryId"]!=null?Request.Query["F_CategoryId"].ToString():""));
  32. var newsListOfSelf = new List<NewsEntity>();
  33. foreach (var newsitemEntity in newsList)
  34. {
  35. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  36. {
  37. if (!string.IsNullOrEmpty(userinfo.postIds))
  38. {
  39. if (userinfo.postIds.Contains(","))
  40. {
  41. foreach (var postid in userinfo.postIds.Split(','))
  42. {
  43. if (newsitemEntity.F_SendPostId.Contains(postid))
  44. {
  45. newsListOfSelf.Add(newsitemEntity);
  46. break;
  47. }
  48. }
  49. }
  50. else
  51. {
  52. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  53. {
  54. newsListOfSelf.Add(newsitemEntity);
  55. }
  56. }
  57. }
  58. }
  59. else
  60. {
  61. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  62. {
  63. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  64. {
  65. newsListOfSelf.Add(newsitemEntity);
  66. }
  67. }
  68. else
  69. {
  70. newsListOfSelf.Add(newsitemEntity);
  71. }
  72. }
  73. }
  74. var jsonData = new
  75. {
  76. rows = newsListOfSelf,
  77. total = newsListOfSelf.Count,
  78. page = 0,
  79. records = newsListOfSelf.Count
  80. };
  81. return Success(jsonData);
  82. }
  83. /// <summary>
  84. /// 获取页面显示列表数据
  85. /// <summary>
  86. /// <param name="_"></param>
  87. /// <returns></returns>
  88. public Response GetshList(dynamic _)
  89. {
  90. NoticeEntity parameter = this.GetReqData<NoticeEntity>();
  91. var shlist = noticeIBLL.GetEntityByProcessId(parameter.ProgressId);
  92. return Success(shlist);
  93. }
  94. #region 私有类
  95. private class NoticeEntity
  96. {
  97. public string ProgressId { get; set; }
  98. }
  99. #endregion
  100. }
  101. }