This commit is contained in:
Putoo
2026-05-23 18:36:37 +08:00
parent 05e340801f
commit dbace8a8b2
27 changed files with 729 additions and 52 deletions

View File

@@ -47,13 +47,17 @@ public class MapController : ControllerBase
string teamId = "";
string groupId = "";
var chatData = await _chatService.GetChatTop(area, 2, teamId, groupId);
//NPC信息
var npcData = await _mapService.GetMapNpc(mapInfo.mapId);
var npcData = await _mapService.GetMapNpc(mapInfo.mapId); //NPC信息
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId, it.areaId));
//城市信息
var cityInfo = await _mapService.GetCityInfo((int)mapInfo.cityId);
var cityShow = await _mapService.GetMapCity(cityInfo.cityId);
var nearUser =
await _mapService.GetMapUser(mapInfo.mapId, area, (int)mapInfo.lookArea, new List<string> { userId },
3); //获取附近的人
var cityInfo = await _mapService.GetCityInfo((int)mapInfo.cityId); //城市信息
var cityShow = await _mapService.GetMapCity(cityInfo.cityId); //城内地图
#region 线
string ip = ComHelper.GetClientUserIp(HttpContext);
@@ -61,8 +65,34 @@ public class MapController : ControllerBase
#endregion
object ret = new { mapInfo, cityInfo, npcData, chatData,cityShow };
object ret = new { mapInfo, cityInfo, npcData, chatData, cityShow, nearUser };
return PoAction.Ok(ret);
}
/// <summary>
/// 获取地图在线玩家
/// </summary>
/// <param name="map"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetMapUser(int page)
{
RefAsync<int> Total = 0;
string userId = StateHelper.userId;
int areaId = StateHelper.areaId;
var onMap = await _mapService.GetUserOnMap(userId);
var mapInfo = await _mapService.GetMapInfo(onMap.mapId);
if (mapInfo == null)
{
return PoAction.Message("地图不存在!");
}
var data = await _mapService.GetMapUser(onMap.mapId, areaId, (int)mapInfo.lookArea, new List<string> { userId }, page,
10, Total);
return PoAction.Ok(new { data, total = Total.Value});
}
}