38 lines
1004 B
C#
38 lines
1004 B
C#
namespace Application.Web.Controllers.User;
|
|
|
|
/// <summary>
|
|
/// 用户背包信息
|
|
/// </summary>
|
|
[ApiExplorerSettings(GroupName = "User")]
|
|
[Route("User/[controller]/[action]")]
|
|
[ApiController]
|
|
[Authorize]
|
|
public class BagController : ControllerBase
|
|
{
|
|
private readonly IUnitUserWeight _weightService;
|
|
|
|
public BagController(IUnitUserWeight weightService)
|
|
{
|
|
_weightService = weightService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取背包信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public async Task<IPoAction> GetUserBagData()
|
|
{
|
|
string userId = StateHelper.userId;
|
|
int onWeight = 0;
|
|
int maxWeight = 0;
|
|
int gold = 0;
|
|
int cowry = 0;
|
|
long copper = 0;
|
|
var userWeight = await _weightService.GetUserWeightInfo(userId);
|
|
onWeight = (int)userWeight.onWeight;
|
|
maxWeight = (int)userWeight.maxWeight;
|
|
|
|
return PoAction.Ok(new { onWeight, maxWeight,cowry, gold, copper });
|
|
}
|
|
} |