namespace Application.Web.Controllers.User; /// /// 用户背包信息 /// [ApiExplorerSettings(GroupName = "User")] [Route("User/[controller]/[action]")] [ApiController] [Authorize] public class BagController : ControllerBase { private readonly IUnitUserWeight _weightService; public BagController(IUnitUserWeight weightService) { _weightService = weightService; } /// /// 获取背包信息 /// /// [HttpGet] public async Task 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 }); } }