71 lines
2.0 KiB
C#
71 lines
2.0 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Application.Web.Controllers.Pub;
|
|
|
|
/// <summary>
|
|
/// 装备接口
|
|
/// </summary>
|
|
[Route("[controller]/[action]")]
|
|
[ApiController]
|
|
[Authorize]
|
|
public class EquController : ControllerBase
|
|
{
|
|
private readonly IGameEquService _equService;
|
|
|
|
public EquController(IGameEquService equService)
|
|
{
|
|
_equService = equService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取装备信息
|
|
/// </summary>
|
|
/// <param name="equId"></param>
|
|
/// <param name="ueId"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<IPoAction> 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 });
|
|
}
|
|
|
|
} |