1212
This commit is contained in:
@@ -16,13 +16,15 @@ namespace Application.Web.Controllers.Login
|
||||
private readonly IGameAccountService _accountService;
|
||||
private readonly IAreaService _areaService;
|
||||
private readonly IUnitUserService _userService;
|
||||
private readonly IUnitUserAttrService _attrService;
|
||||
|
||||
public LoginController(IGameAccountService accountService, IAreaService areaService,
|
||||
IUnitUserService userService)
|
||||
IUnitUserService userService,IUnitUserAttrService attrService)
|
||||
{
|
||||
_accountService = accountService;
|
||||
_areaService = areaService;
|
||||
_userService = userService;
|
||||
_attrService = attrService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -271,6 +273,10 @@ namespace Application.Web.Controllers.Login
|
||||
loadData.Add("accId", userInfo.accId);
|
||||
loadData.Add("areaId", userInfo.areaId);
|
||||
string token = JwtHelper.CreateToken(Key, Issuer, Audience, loadData, TokenConfig.TokenTime);
|
||||
|
||||
//记录在线时间
|
||||
await _attrService.UpdateOnLineTime(userInfo.userId, "Default", TokenConfig.TokenTime);
|
||||
|
||||
return PoAction.Ok(new
|
||||
{ token = token, refToken = userInfo.token, userId = userInfo.userId });
|
||||
}
|
||||
|
||||
@@ -46,15 +46,16 @@ public class MapController : ControllerBase
|
||||
int area = StateHelper.areaId;
|
||||
game_city_map mapInfo = new game_city_map();
|
||||
|
||||
#region 前置条件处理
|
||||
#region 前置条件处理
|
||||
|
||||
var userRunInfo = await _mapService.GetUserRun(userId);
|
||||
if (userRunInfo.status != 0)
|
||||
{
|
||||
return PoAction.Message("正在航行状态", 103);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 地图导向处理
|
||||
|
||||
bool isSelfMap = false;
|
||||
@@ -104,10 +105,26 @@ public class MapController : ControllerBase
|
||||
string ip = ComHelper.GetClientUserIp(HttpContext);
|
||||
await _mapService.UpdateUserOnMap(userId, ip, mapInfo.mapId);
|
||||
|
||||
//地图业务
|
||||
IEnumerable<object> business = new List<object>();
|
||||
if (mapInfo.isBus == 1)
|
||||
{
|
||||
var busData = await _mapService.GetMapBus(mapInfo.mapId, 0, 0);
|
||||
business = busData.Select(it => new
|
||||
{
|
||||
busId = it.busId,
|
||||
busName = it.busName
|
||||
});
|
||||
}
|
||||
//地图资源
|
||||
List<game_city_map_res> mapRes = new List<game_city_map_res>();
|
||||
if (mapInfo.isRes==1)
|
||||
{
|
||||
mapRes = await _mapService.GetMapRes(mapInfo.mapId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
object ret = new
|
||||
{
|
||||
mapInfo,
|
||||
@@ -116,7 +133,9 @@ public class MapController : ControllerBase
|
||||
chatData,
|
||||
cityShow,
|
||||
nearUser,
|
||||
noReadMsg = noReadMsg[3]
|
||||
noReadMsg = noReadMsg[3],
|
||||
business,
|
||||
mapRes
|
||||
};
|
||||
|
||||
return PoAction.Ok(ret);
|
||||
@@ -495,7 +514,14 @@ public class MapController : ControllerBase
|
||||
var toCity = await _mapService.GetCityInfoByMapId(runInfo.toMap);
|
||||
int isShip = 0;
|
||||
int safety = 0;
|
||||
|
||||
string busCode = $"{runInfo.onMap}_{runInfo.toMap}";
|
||||
var busData = await _mapService.GetMapBus(busCode, (int)runInfo.position, (int)runInfo.depth);
|
||||
var business = busData.Select(it => new
|
||||
{
|
||||
busId = it.busId,
|
||||
busName = it.busName
|
||||
});
|
||||
|
||||
return PoAction.Ok(new
|
||||
{
|
||||
onCity = onCity.cityName,
|
||||
@@ -503,7 +529,8 @@ public class MapController : ControllerBase
|
||||
distance = runInfo.distance,
|
||||
position = runInfo.position,
|
||||
isShip = isShip,
|
||||
safety = safety
|
||||
safety = safety,
|
||||
business
|
||||
});
|
||||
}
|
||||
|
||||
@@ -540,6 +567,7 @@ public class MapController : ControllerBase
|
||||
{
|
||||
return PoAction.Message("不在航行状态", 100);
|
||||
}
|
||||
|
||||
var userShip = await _weightService.GetUserShip(userId);
|
||||
if (userShip.Count == 0)
|
||||
{
|
||||
@@ -560,7 +588,8 @@ public class MapController : ControllerBase
|
||||
runInfo.upTime = TimeExtend.GetTimeStampSeconds;
|
||||
if (await _mapService.UpdateUserRunInfo(runInfo))
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
string msg = await _mapService.GetUserRunEvent(userId);
|
||||
return PoAction.Ok(true, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user