41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using Mapster;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Volo.Abp.Application.Services;
|
|
using Yi.Framework.AiHub.Application.Contracts.Dtos.Recharge;
|
|
using Yi.Framework.AiHub.Domain.Entities;
|
|
using Yi.Framework.Rbac.Application.Contracts.IServices;
|
|
using Yi.Framework.Rbac.Domain.Shared.Dtos;
|
|
using Yi.Framework.SqlSugarCore.Abstractions;
|
|
|
|
namespace Yi.Framework.AiHub.Application.Services;
|
|
|
|
/// <summary>
|
|
/// ai 充值表
|
|
/// </summary>
|
|
public class RechargeService : ApplicationService
|
|
{
|
|
private readonly ISqlSugarRepository<AiRechargeAggregateRoot> _repository;
|
|
|
|
public RechargeService(ISqlSugarRepository<AiRechargeAggregateRoot> repository)
|
|
{
|
|
_repository = repository;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询已登录的账户充值记录
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[Route("recharge/account")]
|
|
[Authorize]
|
|
public async Task<List<RechargeGetListOutput>> GetListByAccountAsync()
|
|
{
|
|
var userId = CurrentUser.Id;
|
|
var entities = await _repository._DbQueryable.Where(x => x.UserId == userId)
|
|
.OrderByDescending(x => x.CreationTime)
|
|
.ToListAsync();
|
|
var output = entities.Adapt<List<RechargeGetListOutput>>();
|
|
return output;
|
|
}
|
|
} |