Files
Kg.SeaTime/Service/Application.Web/Controllers/Pub/PubController.cs
Putoo 29b76bab65 11
2026-04-28 16:17:19 +08:00

43 lines
1.2 KiB
C#

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Application.Web.Controllers.Pub
{
/// <summary>
/// 公共接口
/// </summary>
[Route("[controller]/[action]")]
[ApiController]
public class PubController : ControllerBase
{
private readonly IAreaService _areaService;
private readonly INoticeService _noticeService;
public PubController(IAreaService areaService, INoticeService noticeService)
{
_areaService = areaService;
_noticeService = noticeService;
}
/// <summary>
/// 获取首页信息
/// </summary>
/// <param name="sid"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetMain(string? sid)
{
bool isOnline = false;
if (!string.IsNullOrEmpty(sid))
{
isOnline = true;
}
var areaData = await _areaService.GetAreaData();
var notice = await _noticeService.GetNoticeDataByTake(5);
int OnCount = 100;
return PoAction.Ok(new { area = areaData, notice, isOnline, onCount = OnCount });
}
}
}