44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using LFlow.Base.Interfaces;
|
|
using LFlow.Base.Utils;
|
|
using LFlow.OnlineManegement.Model;
|
|
using LFlow.OnlineManegement.Service;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace LFlow.OnlineManegement.Controller;
|
|
/// <summary>
|
|
/// 在线用户管理
|
|
/// </summary>
|
|
/// <param name="service"></param>
|
|
public class OnlineManagementController(IOnlineManagementService service) : BaseController
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
/// 查询所有在线用户
|
|
/// </summary>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public PagedApiResult<List<OnlineDto>> ListAll(int pageIndex, int pageSize)
|
|
{
|
|
int dataTotal = 0;
|
|
var result = service.GetAllOnlineUser(pageIndex, pageSize, ref dataTotal);
|
|
if (result == null || result.Count == 0)
|
|
{
|
|
return PagedFail(result, "No data found", 404);
|
|
}
|
|
return Success(result, dataTotal, pageIndex, pageSize);
|
|
}
|
|
/// <summary>
|
|
/// 注册在线用户
|
|
/// </summary>
|
|
/// <param name="onlineInfo"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public ApiResult<OnlineDto> OnlineRegistered(OnlineDto onlineInfo)
|
|
{
|
|
return Success(service.OnlineRegistered(onlineInfo));
|
|
}
|
|
}
|