|
@@ -217,6 +217,46 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 系统消息
|
|
|
+ /// 获取消息未读条数
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PotsMessageUnreadTotalCount(PotsMessageUnreadTotalCountDto dto)
|
|
|
+ {
|
|
|
+ #region 参数验证
|
|
|
+
|
|
|
+ if (dto.UserId < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请输入有效的UserId参数。"));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ string msgSql = $"Select COUNT(*) As UnreadCount From Sys_MessageReadAuth Where IsRead = 0 And ReadableUId = {dto.UserId}";
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var data = _sqlSugar.SqlQueryable<MessageUnreadTotalCountView>(msgSql).First();
|
|
|
+ if (data != null)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, "操作成功!", data));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(false, "操作失败!"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+
|
|
|
+ return Ok(JsonView(false, ex.Message));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|