Browse Source

【修改】首页消息提醒弹框增加“全部已读”按钮;点击“我的通知”中查看后,同时修改消息提醒已读;

新疆体育高职分支
dyy 1 year ago
parent
commit
d340848ad3
6 changed files with 167 additions and 4 deletions
  1. +11
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/LR_OA_NewsReadController.cs
  2. +17
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs
  3. +29
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml
  4. +48
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs
  5. +13
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs
  6. +49
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs

+ 11
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/LR_OA_NewsReadController.cs View File

@@ -18,6 +18,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers
public class LR_OA_NewsReadController : MvcControllerBase
{
private LR_OA_NewsReadIBLL lR_OA_NewsReadIBLL = new LR_OA_NewsReadBLL();
private MessageRindIBLL messageRindIBLL = new MessageRindBLL();

#region 视图功能

@@ -156,6 +157,16 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers
//修改当前通知公告的浏览量
lR_OA_NewsReadIBLL.UpdateNewsPV(newsId);
}
//判断消息提醒表中的消息是否已读
var mrentity = messageRindIBLL.GetMessageRemindEntityByInstanceId(newsId, loginUserInfo.userId);
if (mrentity != null)
{
if (!mrentity.ReadSigns.HasValue || mrentity.ReadSigns.Value != true)
{
//修改消息为已读
messageRindIBLL.SaveReadSigns(mrentity.MessageId);
}
}

return Success("阅读成功!");
}


+ 17
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs View File

@@ -182,6 +182,23 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers
return Success("保存成功!");
}

/// <summary>
/// 更改状态为已读
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult SaveReadSignsByUserId()
{
var loginUserInfo = LoginUserInfo.Get();
if (!string.IsNullOrEmpty(loginUserInfo.userId))
{
messageRindIBLL.SaveReadSignsByUserId(loginUserInfo.userId);
}
return Success("保存成功!");
}

#endregion

}


+ 29
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml View File

@@ -25,9 +25,20 @@
"/Views/LR_Content/style/lr-iframe-index.css",
"~/Content/jquery/plugin/toastr/toastr.css"
)

<style>
#allRead {
display: inline-block;
padding: 5px 10px;
color: blue;
border: 1px solid blue;
border-radius: 3px;
cursor:pointer;
margin-bottom:5px;
}
</style>
</head>
<body>
<div id="allRead" class="btn btn-default">全部已读</div>
<div id='content'>

</div>
@@ -39,7 +50,7 @@
"~/Areas/LR_Desktop/Views/MessageRind/Index.js"
)

<script type='text/javascript'>
<script type='text/javascript'>
var name = '@(ViewBag.Name)';
$(document).ready(function () {
getdata();
@@ -116,6 +127,21 @@


});

//点击“全部已读”
$('#allRead').on('click', function () {
$.ajax({
url: top.$.rootUrl + '/LR_Desktop/MessageRind/SaveReadSignsByUserId',
type: "post",
data: { },
dataType: "json",
async: false,
success: function (data) {
location.reload();
}
})
});

});

//function funLook(param) {
@@ -136,6 +162,6 @@

//}

</script>
</script>
</body>
</html>

+ 48
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs View File

@@ -66,7 +66,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
}
}

/// <summary>
/// 未读消息的数量
/// </summary>
@@ -114,6 +114,29 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
}
}

/// <summary>
/// 获取MessageRemind表实体数据
/// </summary>
/// <param name="InstanceId">主键</param>
/// <returns></returns>
public MessageRemindEntity GetMessageRemindEntityByInstanceId(string InstanceId, string userId)
{
try
{
return messageRindService.GetMessageRemindEntityByInstanceId(InstanceId, userId);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
#endregion

#region 提交数据
@@ -188,6 +211,30 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
}
}
}

/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="userId">主键</param>
public void SaveReadSignsByUserId(string userId)
{
try
{
messageRindService.SaveReadSignsByUserId(userId);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

#endregion

}


+ 13
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs View File

@@ -37,6 +37,13 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
/// <param name="keyValue">主键</param>
/// <returns></returns>
MessageRemindEntity GetMessageRemindEntity(string keyValue);

/// <summary>
/// 获取MessageRemind表实体数据
/// </summary>
/// <param name="InstanceId">主键</param>
/// <returns></returns>
MessageRemindEntity GetMessageRemindEntityByInstanceId(string InstanceId, string userId);
#endregion

#region 提交数据
@@ -57,6 +64,12 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
/// </summary>
/// <param name="keyValue"></param>
void SaveReadSigns(string keyValue);

/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="userId">主键</param>
void SaveReadSignsByUserId(string userId);
#endregion

}


+ 49
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs View File

@@ -141,6 +141,30 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
}
}

/// <summary>
/// 获取MessageRemind表实体数据
/// </summary>
/// <param name="InstanceId">主键</param>
/// <returns></returns>
public MessageRemindEntity GetMessageRemindEntityByInstanceId(string InstanceId, string userId)
{
try
{
return this.BaseRepository().FindEntity<MessageRemindEntity>(x => x.InstanceId == InstanceId && x.ReceiptId == userId);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

#endregion

#region 提交数据
@@ -230,6 +254,31 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
}
}
}

/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="userId">主键</param>
public void SaveReadSignsByUserId(string userId)
{
try
{
string sql = $"update MessageRemind set ReadSigns=1 where ReceiptId='{userId}' and ReadSigns<>1 ";
this.BaseRepository().ExecuteBySql(sql);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

#endregion

}


Loading…
Cancel
Save