feat: 完成基础接口搭建

This commit is contained in:
橙子
2024-10-15 22:14:14 +08:00
parent a0ef3af155
commit 3383e86064
6 changed files with 143 additions and 2 deletions

View File

@@ -29,7 +29,7 @@ public class CollectiblesService : ApplicationService
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
[HttpGet("user")]
[HttpGet("collectibles/user")]
[Authorize]
public async Task<PagedResultDto<CollectiblesUserGetOutputDto>> GetForAccountUserAsync(
CollectiblesUserGetInput input)

View File

@@ -0,0 +1,41 @@
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Services;
using Volo.Abp.Users;
using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.MiningPool;
using Yi.Framework.DigitalCollectibles.Domain.Managers;
namespace Yi.Framework.DigitalCollectibles.Application.Services;
public class MiningPoolService : ApplicationService
{
private readonly MiningPoolManager _manager;
/// <summary>
/// 获取矿池状态
/// </summary>
/// <returns></returns>
[HttpGet("mining-pool")]
public async Task<MiningPoolGetOutput> GetMiningPoolContentAsync()
{
var content = await _manager.GetMiningPoolContentAsync();
var output = content.Adapt<MiningPoolGetOutput>();
return output;
}
/// <summary>
/// 用户手动挖矿
/// </summary>
/// <returns></returns>
[HttpPost("mining-pool/mining")]
[Authorize]
public async Task<MiningResultOutput> MiningAsync()
{
var userId = CurrentUser.GetId();
var result = await _manager.MiningAsync(userId);
var output = result.Adapt<MiningResultOutput>();
return output;
}
}