222
This commit is contained in:
38
Service/Application.Web/Controllers/User/BagController.cs
Normal file
38
Service/Application.Web/Controllers/User/BagController.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user