1111
This commit is contained in:
@@ -12,16 +12,19 @@ public class UserController : ControllerBase
|
||||
private readonly IUnitUserAttrService _attrService;
|
||||
private readonly IUnitUserAccService _accService;
|
||||
private readonly IGameMapService _mapService;
|
||||
private readonly IUnitUserRelationService _relationService;
|
||||
|
||||
public UserController(IUnitUserService userService, IUnitUserAttrService attrService,
|
||||
IUnitUserAccService accService, IGameMapService mapService)
|
||||
IUnitUserAccService accService, IGameMapService mapService,IUnitUserRelationService relationService)
|
||||
{
|
||||
_userService = userService;
|
||||
_attrService = attrService;
|
||||
_accService = accService;
|
||||
_mapService = mapService;
|
||||
_relationService = relationService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取个人资料信息
|
||||
@@ -44,6 +47,33 @@ public class UserController : ControllerBase
|
||||
return PoAction.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取基础资料信息
|
||||
/// </summary>
|
||||
/// <param name="no"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetUserBaseInfo(string no)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
var userInfo = await _userService.GetUserInfoByUserNo(no); //基础资料
|
||||
if (userInfo == null)
|
||||
{
|
||||
return PoAction.Message("玩家不存在!", 102);
|
||||
}
|
||||
|
||||
if (userInfo.userId == userId)
|
||||
{
|
||||
return PoAction.Message("用户本身!", 101);
|
||||
}
|
||||
if (userInfo.areaId != StateHelper.areaId)
|
||||
{
|
||||
return PoAction.Message("玩家不存在!", 102);
|
||||
}
|
||||
|
||||
var model = await UserModelTool.GetUserView(userInfo.userId);
|
||||
return PoAction.Ok(model);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取用户资料
|
||||
/// </summary>
|
||||
@@ -81,8 +111,8 @@ public class UserController : ControllerBase
|
||||
var onMapInfo = await _mapService.GetMapInfo(online.mapId);
|
||||
var onCity = await _mapService.GetCityInfo((int)onMapInfo.cityId);
|
||||
string onMapName = $"{onCity.cityName}-{onMapInfo.mapName}";
|
||||
|
||||
object result = new { user, attr = new { attrInfo.lev }, acc, isOnline, onMapName };
|
||||
bool isFriend = await _relationService.CheckIsFriend(userId, userInfo.userId);
|
||||
object result = new { user, attr = new { attrInfo.lev }, acc, isOnline, onMapName ,isFriend};
|
||||
return PoAction.Ok(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user