feat: 添加推送通知功能,支持订阅和发送通知
This commit is contained in:
@@ -12,7 +12,7 @@ public interface IMessageRecordService
|
||||
Task<long> GetUnreadCountAsync();
|
||||
}
|
||||
|
||||
public class MessageRecordService(IMessageRecordRepository messageRepo) : IMessageRecordService
|
||||
public class MessageRecordService(IMessageRecordRepository messageRepo, INotificationService notificationService) : IMessageRecordService
|
||||
{
|
||||
public async Task<(IEnumerable<MessageRecord> List, long Total)> GetPagedListAsync(int pageIndex, int pageSize)
|
||||
{
|
||||
@@ -37,7 +37,12 @@ public class MessageRecordService(IMessageRecordRepository messageRepo) : IMessa
|
||||
Content = content,
|
||||
IsRead = false
|
||||
};
|
||||
return await messageRepo.AddAsync(message);
|
||||
var result = await messageRepo.AddAsync(message);
|
||||
if (result)
|
||||
{
|
||||
await notificationService.SendNotificationAsync($"新增的账单通知: {title}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> MarkAsReadAsync(long id)
|
||||
|
||||
Reference in New Issue
Block a user