From aea3d95d5836697df7b0f241c75ce343c30ebd96 Mon Sep 17 00:00:00 2001 From: liangkun Date: Wed, 26 Apr 2023 10:30:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0h5=E6=B6=88=E6=81=AF=E9=98=85?= =?UTF-8?q?=E8=AF=BB=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/NewsApi.cs | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs index 20394b036..e28c2593a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/NewsApi.cs @@ -1,4 +1,5 @@ -using Learun.Application.AppMagager; +using System; +using Learun.Application.AppMagager; using Learun.Util; using Nancy; using System.Collections.Generic; @@ -15,6 +16,7 @@ namespace Learun.Application.WebApi.Modules public class NewsApi : BaseApi { private NoticeIBLL noticeIBLL = new NoticeBLL(); + LR_OA_NewsReadIBLL lR_OA_NewsReadIBLL=new LR_OA_NewsReadBLL(); public NewsApi() : base("/learun/news") @@ -22,6 +24,41 @@ namespace Learun.Application.WebApi.Modules Get["/list"] = GetList; } + #region 私有类 + private class NoticeEntity + { + public string ProgressId { get; set; } + public string newsId { get; set; } + } + #endregion + /// + /// 阅读通知公告 + /// + /// + public Response NewsRead(dynamic _) + { + var loginUserInfo = LoginUserInfo.Get(); + NoticeEntity parameter = this.GetReqData(); + + //判断当前用户是否阅读当前通知公告 + var entity = lR_OA_NewsReadIBLL.GetLR_OA_NewsReadEntityByNewsIdAndUserId(parameter.newsId, loginUserInfo.userId); + if (entity == null) + { + var lR_OA_NewsRead = new LR_OA_NewsReadEntity() + { + NewsId = parameter.newsId, + RUserId = loginUserInfo.userId, + RUserName = loginUserInfo.realName, + RTime = DateTime.Now + }; + lR_OA_NewsReadIBLL.SaveEntity("", lR_OA_NewsRead); + + //修改当前通知公告的浏览量 + lR_OA_NewsReadIBLL.UpdateNewsPV(parameter.newsId); + } + + return Success("阅读成功!"); + } /// /// 获取页面显示列表数据