feat: 新增用户信息

This commit is contained in:
橙子
2024-10-20 22:31:39 +08:00
parent 8ca741792a
commit fcaad5c6cc
6 changed files with 38 additions and 13 deletions

View File

@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Users;
using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles;
using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market;
using Yi.Framework.DigitalCollectibles.Domain.Entities;
@@ -24,6 +25,23 @@ public class CollectiblesService : ApplicationService
_collectiblesUserStoreRepository = collectiblesUserStoreRepository;
}
/// <summary>
/// 获取该用户的信息
/// </summary>
[HttpGet("collectibles/account")]
[Authorize]
public async Task<CollectiblesAccountInfoDto> GetAccountInfoAsync()
{
var userId = CurrentUser.GetId();
var totalValue = await _collectiblesUserStoreRepository._DbQueryable.Where(store => store.UserId == userId)
.LeftJoin<CollectiblesAggregateRoot>((store, c) => store.CollectiblesId == c.Id)
.SumAsync((store, c) => c.ValueNumber);
return new CollectiblesAccountInfoDto
{
TotalValue = totalValue
};
}
/// <summary>
/// 获取当前用户的藏品
/// </summary>
@@ -40,7 +58,7 @@ public class CollectiblesService : ApplicationService
input.StartTime is not null && input.EndTime is not null,
u => u.CreationTime >= input.StartTime && u.CreationTime <= input.EndTime)
.LeftJoin<CollectiblesAggregateRoot>((u, c) => u.CollectiblesId == c.Id)
.OrderBy((u,c) => c.OrderNum)
.OrderBy((u, c) => c.OrderNum)
.GroupBy((u, c) => u.CollectiblesId)
.Select((u, c) =>
new CollectiblesUserGetOutputDto

View File

@@ -52,6 +52,7 @@ public class MarketService : ApplicationService
CreationTime = m.CreationTime,
SellUserId = m.SellUserId,
SellNumber = m.SellNumber,
UnitPrice=m.UnitPrice,
Collectibles = new CollectiblesDto
{
Id = c.Id,
@@ -75,17 +76,17 @@ public class MarketService : ApplicationService
/// <summary>
/// 上架商品
/// </summary>
[HttpPost("shelved")]
[HttpPost("market/shelved")]
[Authorize]
public async Task ShelvedGoodsAsync(ShelvedGoodsDto input)
{
await _marketManager.ShelvedGoodsAsync(CurrentUser.GetId(), input.CollectiblesId, input.Number, input.Mmoney);
await _marketManager.ShelvedGoodsAsync(CurrentUser.GetId(), input.CollectiblesId, input.Number, input.Money);
}
/// <summary>
/// 购买商品
/// </summary>
[HttpPut("purchase")]
[HttpPut("market/purchase")]
[Authorize]
public async Task PurchaseGoodsAsync(PurchaseGoodsDto input)
{