This commit is contained in:
Putoo
2026-05-22 09:07:38 +08:00
parent 784bc66ef6
commit 0016ef7e83
22 changed files with 666 additions and 62 deletions

View File

@@ -13,11 +13,13 @@ public class MapController : ControllerBase
{
private readonly IUnitUserService _userService;
private readonly IGameMapService _mapService;
private readonly IGameChatService _chatService;
public MapController(IUnitUserService userService, IGameMapService mapService)
public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService)
{
_userService = userService;
_mapService = mapService;
_chatService = chatService;
}
/// <summary>
@@ -29,6 +31,7 @@ public class MapController : ControllerBase
public async Task<IPoAction> GetMapData(string? map)
{
string userId = StateHelper.userId;
int area = StateHelper.areaId;
var onMap = await _mapService.GetUserOnMap(userId);
game_city_map mapInfo = new game_city_map();
if (string.IsNullOrEmpty(map))
@@ -40,10 +43,14 @@ public class MapController : ControllerBase
mapInfo = await _mapService.GetMapInfo(map);
}
//公聊信息
string teamId = "";
string groupId = "";
var chatData = await _chatService.GetChatTop(area, 2, teamId, groupId);
//NPC信息
var npcData = await _mapService.GetMapNpc(mapInfo.mapId);
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId,it.areaId));
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId, it.areaId));
//城市信息
var cityInfo = await _mapService.GetCityInfo((int)mapInfo.cityId);
@@ -54,7 +61,7 @@ public class MapController : ControllerBase
#endregion
object ret = new { mapInfo, cityInfo, npcData };
object ret = new { mapInfo, cityInfo, npcData, chatData };
return PoAction.Ok(ret);
}