using Microsoft.AspNetCore.Mvc;
namespace Application.Web.Controllers.Pub;
///
/// 装备接口
///
[Route("[controller]/[action]")]
[ApiController]
[Authorize]
public class EquController : ControllerBase
{
private readonly IGameEquService _equService;
public EquController(IGameEquService equService)
{
_equService = equService;
}
///
/// 获取装备信息
///
///
///
///
[HttpGet]
public async Task GetEquInfo(int? equId, string? ueId)
{
game_equ equInfo = new game_equ();
game_equ_suit suit = new game_equ_suit();
unit_user_equ ueInfo = new unit_user_equ();
UserModel user = new UserModel();
if (equId != 0)
{
equInfo = await _equService.GetEquInfo((int)equId);
if (equInfo == null)
{
return PoAction.Message("装备不存在!");
}
if (equInfo.suitCode != "0" && !string.IsNullOrEmpty(equInfo.suitCode))
{
suit = await _equService.GetEuqSuitInfo(equInfo.suitCode);
}
}
else
{
ueInfo = await _equService.GetUserEquInfo(ueId);
if (ueInfo == null)
{
return PoAction.Message("装备不存在!");
}
equInfo = await _equService.GetEquInfo((int)ueInfo.equId);
if (equInfo == null)
{
return PoAction.Message("装备不存在!");
}
if (equInfo.suitCode != "0" && !string.IsNullOrEmpty(equInfo.suitCode))
{
suit = await _equService.GetEuqSuitInfo(equInfo.suitCode);
}
user = await UserModelTool.GetUserView(ueInfo.owerId);
}
return PoAction.Ok(new { equ = equInfo, suit, equData = ueInfo,user });
}
}