feat: 新增矿池机制

This commit is contained in:
chenchun
2024-10-15 18:32:50 +08:00
parent 1c6a795061
commit e8fcab4c6b
13 changed files with 313 additions and 20 deletions

View File

@@ -1,17 +1,28 @@
using Microsoft.AspNetCore.Authorization;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles;
using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market;
using Yi.Framework.DigitalCollectibles.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.DigitalCollectibles.Application.Services;
/// <summary>
/// 藏品应用服务
/// </summary>
public class CollectiblesService:ApplicationService
public class CollectiblesService : ApplicationService
{
private readonly ISqlSugarRepository<CollectiblesUserStoreAggregateRoot> _collectiblesUserStoreRepository;
public CollectiblesService(ISqlSugarRepository<CollectiblesUserStoreAggregateRoot> collectiblesUserStoreRepository)
{
_collectiblesUserStoreRepository = collectiblesUserStoreRepository;
}
/// <summary>
/// 获取当前用户的藏品
/// </summary>
@@ -20,8 +31,16 @@ public class CollectiblesService:ApplicationService
/// <exception cref="NotImplementedException"></exception>
[HttpGet("user")]
[Authorize]
public async Task<PagedResultDto<CollectiblesUserGetOutputDto>> GetForAccountUserAsync(CollectiblesUserGetInput input)
public async Task<PagedResultDto<CollectiblesUserGetOutputDto>> GetForAccountUserAsync(
CollectiblesUserGetInput input)
{
throw new NotImplementedException();
RefAsync<int> total = 0;
var entities = await _collectiblesUserStoreRepository._DbQueryable.WhereIF(
input.StartTime is not null && input.EndTime is not null,
x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.OrderByDescending(x => x.CreationTime)
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
var output = entities.Adapt<List<CollectiblesUserGetOutputDto>>();
return new PagedResultDto<CollectiblesUserGetOutputDto>(total, output);
}
}

View File

@@ -1,6 +1,10 @@
using Volo.Abp.Application.Dtos;
using Mapster;
using SqlSugar;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market;
using Yi.Framework.DigitalCollectibles.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.DigitalCollectibles.Application.Services;
@@ -9,14 +13,27 @@ namespace Yi.Framework.DigitalCollectibles.Application.Services;
/// </summary>
public class MarketService:ApplicationService
{
private readonly ISqlSugarRepository<MarketGoodsAggregateRoot> _marketGoodsRepository;
public MarketService(ISqlSugarRepository<MarketGoodsAggregateRoot> marketGoodsRepository)
{
_marketGoodsRepository = marketGoodsRepository;
}
/// <summary>
/// 交易市场查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<PagedResultDto<MarketGetListOutputDto>> GetListAsync(MarketGetListInput input)
{
throw new NotImplementedException();
RefAsync<int> total = 0;
var entities = await _marketGoodsRepository._DbQueryable.WhereIF(
input.StartTime is not null && input.EndTime is not null,
x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.OrderByDescending(x => x.CreationTime)
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
var output = entities.Adapt<List<MarketGetListOutputDto>>();
return new PagedResultDto<MarketGetListOutputDto>(total, output);
}
}