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.
 
 
 
 
 
 

178 lines
4.9 KiB

  1. using Learun.Util;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace Learun.Application.IM
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
  8. /// Copyright (c) 2013-2018 上海力软信息技术有限公司
  9. /// 创建人:力软-框架开发组
  10. /// 日 期:2017.04.17
  11. /// 描 述:即时通讯消息内容
  12. /// </summary>
  13. public class IMMsgBLL: IMMsgIBLL
  14. {
  15. private IMMsgService iMMsgService = new IMMsgService();
  16. #region 获取数据
  17. /// <summary>
  18. /// 获取列表数据(最近的10条聊天记录)
  19. /// <summary>
  20. /// <returns></returns>
  21. public IEnumerable<IMMsgEntity> GetList(string sendUserId, string recvUserId)
  22. {
  23. try
  24. {
  25. return iMMsgService.GetList(sendUserId, recvUserId);
  26. }
  27. catch (Exception ex)
  28. {
  29. if (ex is ExceptionEx)
  30. {
  31. throw;
  32. }
  33. else
  34. {
  35. throw ExceptionEx.ThrowBusinessException(ex);
  36. }
  37. }
  38. }
  39. /// <summary>
  40. /// 获取列表数据(小于某个时间点的5条记录)
  41. /// </summary>
  42. /// <param name="myUserId">我的ID</param>
  43. /// <param name="otherUserId">对方的ID</param>
  44. /// <param name="time">时间</param>
  45. /// <returns></returns>
  46. public IEnumerable<IMMsgEntity> GetListByTime(string myUserId, string otherUserId, DateTime time)
  47. {
  48. try
  49. {
  50. return iMMsgService.GetListByTime(myUserId, otherUserId, time);
  51. }
  52. catch (Exception ex)
  53. {
  54. if (ex is ExceptionEx)
  55. {
  56. throw;
  57. }
  58. else
  59. {
  60. throw ExceptionEx.ThrowServiceException(ex);
  61. }
  62. }
  63. }
  64. /// <summary>
  65. /// 获取列表数据(大于某个时间的所有数据)
  66. /// </summary>
  67. /// <param name="myUserId">我的ID</param>
  68. /// <param name="otherUserId">对方的ID</param>
  69. /// <param name="time">时间</param>
  70. /// <returns></returns>
  71. public IEnumerable<IMMsgEntity> GetListByTime2(string myUserId, string otherUserId, DateTime time)
  72. {
  73. try
  74. {
  75. return iMMsgService.GetListByTime2(myUserId, otherUserId, time);
  76. }
  77. catch (Exception ex)
  78. {
  79. if (ex is ExceptionEx)
  80. {
  81. throw;
  82. }
  83. else
  84. {
  85. throw ExceptionEx.ThrowServiceException(ex);
  86. }
  87. }
  88. }
  89. /// <summary>
  90. /// 获取列表分页数据
  91. /// <summary>
  92. /// <param name="pagination">分页参数</param>
  93. /// <param name="sendUserId"></param>
  94. /// <param name="recvUserId"></param>
  95. /// <param name="keyword"></param>
  96. /// <returns></returns>
  97. public IEnumerable<IMMsgEntity> GetPageList(Pagination pagination, string sendUserId, string recvUserId, string keyword)
  98. {
  99. try
  100. {
  101. return iMMsgService.GetPageList(pagination, sendUserId, recvUserId, keyword);
  102. }
  103. catch (Exception ex)
  104. {
  105. if (ex is ExceptionEx)
  106. {
  107. throw;
  108. }
  109. else
  110. {
  111. throw ExceptionEx.ThrowBusinessException(ex);
  112. }
  113. }
  114. }
  115. #endregion
  116. #region 提交数据
  117. /// <summary>
  118. /// 删除实体数据
  119. /// <param name="keyValue">主键</param>
  120. /// <summary>
  121. /// <returns></returns>
  122. public void DeleteEntity(string keyValue)
  123. {
  124. try
  125. {
  126. iMMsgService.DeleteEntity(keyValue);
  127. }
  128. catch (Exception ex)
  129. {
  130. if (ex is ExceptionEx)
  131. {
  132. throw;
  133. }
  134. else
  135. {
  136. throw ExceptionEx.ThrowBusinessException(ex);
  137. }
  138. }
  139. }
  140. /// <summary>
  141. /// 保存实体数据(新增)
  142. /// <param name="entity">实体</param>
  143. /// <summary>
  144. /// <returns></returns>
  145. public void SaveEntity(IMMsgEntity entity)
  146. {
  147. try
  148. {
  149. iMMsgService.SaveEntity(entity);
  150. }
  151. catch (Exception ex)
  152. {
  153. if (ex is ExceptionEx)
  154. {
  155. throw;
  156. }
  157. else
  158. {
  159. throw ExceptionEx.ThrowBusinessException(ex);
  160. }
  161. }
  162. }
  163. #endregion
  164. }
  165. }