Files
Kg.SeaTime/Service/Application.Web/Controllers/User/BagController.cs
Putoo dbace8a8b2 222
2026-05-23 18:36:37 +08:00

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 });
}
}