This commit is contained in:
Putoo
2026-05-18 13:28:20 +08:00
parent 78759387f7
commit 974421ce9b
13 changed files with 200 additions and 39 deletions

View File

@@ -12,11 +12,13 @@ namespace Application.Web.Controllers.Pub
{
private readonly IAreaService _areaService;
private readonly INoticeService _noticeService;
private readonly IGameAccountService _accountService;
public PubController(IAreaService areaService, INoticeService noticeService)
public PubController(IAreaService areaService, INoticeService noticeService,IGameAccountService accountService)
{
_areaService = areaService;
_noticeService = noticeService;
_accountService = accountService;
}
/// <summary>
@@ -28,16 +30,35 @@ namespace Application.Web.Controllers.Pub
public async Task<IPoAction> GetMain(string? sid)
{
bool isOnline = false;
game_account account = new game_account();
if (!string.IsNullOrEmpty(sid))
{
isOnline = true;
account = await _accountService.GetAccInfoByToken(sid);
if (account != null)
{
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 });
return PoAction.Ok(new { area = areaData, notice, isOnline, onCount = OnCount,account });
}
/// <summary>
/// 获取公告列表
/// </summary>
/// <param name="page"></param>
/// <param name="limit"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetNoticeData(int page,int limit)
{
RefAsync<int> total = 0;
var data = await _noticeService.GetNoticeData(page, limit, total);
return PoAction.Ok(new { data, total=total.Value });
}
}
}

View File

@@ -4,6 +4,7 @@ global using Photon.Core.Services;
global using Photon.Core.SqlSugar;
global using Photon.Core.Assist;
global using Photon.Core.Timer;
global using SqlSugar;
global using Application.Service.Pub;
global using Application.Domain;