|
@@ -41,6 +41,7 @@ using Hotline.Settings.Hotspots;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
using XF.Utility.MQ;
|
|
|
using System.Threading;
|
|
|
+using BulletinOutDto = Hotline.Share.Dtos.Article.BulletinOutDto;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
namespace Hotline.Application.Snapshot;
|
|
@@ -398,7 +399,7 @@ public abstract class SnapshotApplicationBase
|
|
|
{
|
|
|
var items = await _notificationReceiverRepository.Queryable()
|
|
|
.LeftJoin<Notification>((m , notify) => m.NotificationId == notify.Id)
|
|
|
- .Where(m => m.ReceiverId == _sessionContext.UserId)
|
|
|
+ .Where((m, notify) => m.ReceiverId == _sessionContext.UserId && dto.NotifyType == notify.NotifyType)
|
|
|
.Select((m, notify) => new GetNotifyOutDto
|
|
|
{
|
|
|
NotificationId = m.NotificationId,
|
|
@@ -1058,6 +1059,46 @@ public abstract class SnapshotApplicationBase
|
|
|
item.Insert(0, my);
|
|
|
}
|
|
|
outDto.Ranks = item;
|
|
|
+
|
|
|
+
|
|
|
+ outDto.VideoBulletin = await _notificationReceiverRepository.Queryable()
|
|
|
+ .LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
|
|
|
+ .LeftJoin<SnapshotBulletin>((receiver, notify, bulletin) => bulletin.Id == notify.ExternalId)
|
|
|
+ .Where((receiver, notify) => receiver.ReceiverId == _sessionContext.UserId)
|
|
|
+ .GroupBy((receiver, notify, bulletin) => new
|
|
|
+ {
|
|
|
+ notify.Title,
|
|
|
+ notify.ExternalId,
|
|
|
+ bulletin.SnapshotBulletinTypeName,
|
|
|
+ bulletin.VideoCoverImgUrl,
|
|
|
+ notify.CreationTime
|
|
|
+ })
|
|
|
+ .OrderByDescending((receiver, notify) => notify.CreationTime)
|
|
|
+ .Select((receiver, notify, bulletin) => new VideoBulletinOutDto
|
|
|
+ {
|
|
|
+ Title = notify.Title,
|
|
|
+ BulletinId = notify.ExternalId,
|
|
|
+ UnReadCount = SqlFunc.AggregateSum(SqlFunc.IIF( receiver.IsRead == false, 1, 0)),
|
|
|
+ SnapshotBulletinTypeName = bulletin.SnapshotBulletinTypeName,
|
|
|
+ VideoCoverImgUrl = bulletin.VideoCoverImgUrl,
|
|
|
+ }).FirstAsync();
|
|
|
+
|
|
|
+ outDto.Bulletins = new PointsBulletinOutDto
|
|
|
+ {
|
|
|
+ Items = await _notificationReceiverRepository.Queryable()
|
|
|
+ .LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
|
|
|
+ .Select((receiver, notify) => new PointsBulletinItemsOutDto
|
|
|
+ {
|
|
|
+ BulletinId = notify.ExternalId,
|
|
|
+ Title = notify.Title,
|
|
|
+ }, true)
|
|
|
+ .Take(2)
|
|
|
+ .ToListAsync(),
|
|
|
+ UnReadCount = await _notificationReceiverRepository.Queryable()
|
|
|
+ .Where(m => m.IsRead == false && m.ReceiverId == _sessionContext.UserId)
|
|
|
+ .CountAsync()
|
|
|
+ };
|
|
|
+
|
|
|
return outDto;
|
|
|
}
|
|
|
#endregion
|