You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

101 lines
2.8 KiB

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Message.Application.Contracts;
namespace Win_in.Sfs.Wms.Pda.Controllers.Messages;
/// <summary>
///
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}store/message")]
public class MessageController : AbpController
{
private readonly INotifyMessageService _notifyMessageService;
private readonly IUserNotifyMessageService _userNotifyMessageService;
/// <summary>
///
/// </summary>
/// <param name="notifyMessageService"></param>
/// <param name="userNotifyMessageService"></param>
public MessageController(
INotifyMessageService notifyMessageService,
IUserNotifyMessageService userNotifyMessageService)
{
_notifyMessageService = notifyMessageService;
_userNotifyMessageService = userNotifyMessageService;
}
/// <summary>
///
/// </summary>
/// <param name="messageId"></param>
/// <returns></returns>
[HttpGet("{messageId}")]
public virtual async Task<NotifyMessageDto> GetMessageAsync(Guid messageId)
{
return await _notifyMessageService.GetAsync(messageId).ConfigureAwait(false);
}
/// <summary>
///
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpGet("list/{userId}")]
public virtual async Task<List<UserNotifyMessageDto>> GetListAsync(Guid userId)
{
return await _userNotifyMessageService.GetListAsync(userId).ConfigureAwait(false);
}
/// <summary>
///
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpGet("not-read-list/{userId}")]
public virtual async Task<List<UserNotifyMessageDto>> GetNotReadListAsync(Guid userId)
{
return await _userNotifyMessageService.GetNotReadListAsync(userId).ConfigureAwait(false);
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
[HttpPost("read/{id}")]
public virtual async Task ReadAsync(Guid id)
{
await _userNotifyMessageService.ReadAsync(id).ConfigureAwait(false);
}
/// <summary>
///
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpGet("count/{userId}")]
public virtual async Task<int> GetCountAsync(Guid userId)
{
return await _userNotifyMessageService.GetCountAsync(userId).ConfigureAwait(false);
}
/// <summary>
///
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpGet("not-read-count/{userId}")]
public virtual async Task<int> GetNotReadCountAsync(Guid userId)
{
return await _userNotifyMessageService.GetNotReadCountAsync(userId).ConfigureAwait(false);
}
}