增加
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user