From 5f2133eb50ce3bcd0cbd2559fa09529dae5f73cc Mon Sep 17 00:00:00 2001 From: ccnetcore Date: Sat, 10 Jan 2026 00:56:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B4=A6=E6=88=B7=E5=85=85=E5=80=BC?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9F=A5=E8=AF=A2=E6=94=AF=E6=8C=81=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E4=B8=8E=E6=9D=A1=E4=BB=B6=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为已登录账户的充值记录查询新增分页能力,支持按时间区间、是否免费、充值金额范围等条件筛选,并统一返回 PagedResultDto 结构,同时同步更新服务接口定义。 --- .../Dtos/Recharge/RechargeGetListInput.cs | 24 +++++++++++++++++++ .../IServices/IRechargeService.cs | 8 ++++++- .../Services/RechargeService.cs | 22 +++++++++++++---- 3 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/Recharge/RechargeGetListInput.cs diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/Recharge/RechargeGetListInput.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/Recharge/RechargeGetListInput.cs new file mode 100644 index 00000000..341cf37c --- /dev/null +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/Recharge/RechargeGetListInput.cs @@ -0,0 +1,24 @@ +using Yi.Framework.Ddd.Application.Contracts; + +namespace Yi.Framework.AiHub.Application.Contracts.Dtos.Recharge; + +/// +/// 充值记录查询输入 +/// +public class RechargeGetListInput : PagedAllResultRequestDto +{ + /// + /// 是否免费(充值金额等于0) + /// + public bool? IsFree { get; set; } + + /// + /// 充值金额最小值 + /// + public decimal? MinRechargeAmount { get; set; } + + /// + /// 充值金额最大值 + /// + public decimal? MaxRechargeAmount { get; set; } +} diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/IServices/IRechargeService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/IServices/IRechargeService.cs index 838d392f..a80cb85f 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/IServices/IRechargeService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/IServices/IRechargeService.cs @@ -1,9 +1,15 @@ -using Yi.Framework.AiHub.Application.Contracts.Dtos.Recharge; +using Volo.Abp.Application.Dtos; +using Yi.Framework.AiHub.Application.Contracts.Dtos.Recharge; namespace Yi.Framework.AiHub.Application.Contracts.IServices; public interface IRechargeService { + /// + /// 查询已登录的账户充值记录(分页) + /// + Task> GetListByAccountAsync(RechargeGetListInput input); + /// /// 移除用户vip及角色 /// diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/RechargeService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/RechargeService.cs index 312dac87..dbfd286f 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/RechargeService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/RechargeService.cs @@ -1,6 +1,8 @@ using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Users; using Yi.Framework.AiHub.Application.Contracts.Dtos.Recharge; @@ -35,19 +37,29 @@ namespace Yi.Framework.AiHub.Application.Services } /// - /// 查询已登录的账户充值记录 + /// 查询已登录的账户充值记录(分页) /// /// [Route("recharge/account")] [Authorize] - public async Task> GetListByAccountAsync() + public async Task> GetListByAccountAsync([FromQuery]RechargeGetListInput input) { var userId = CurrentUser.Id; - var entities = await _repository._DbQueryable.Where(x => x.UserId == userId) + RefAsync total = 0; + + var entities = await _repository._DbQueryable + .Where(x => x.UserId == userId) + .WhereIF(input.StartTime.HasValue, x => x.CreationTime >= input.StartTime!.Value) + .WhereIF(input.EndTime.HasValue, x => x.CreationTime <= input.EndTime!.Value) + .WhereIF(input.IsFree == true, x => x.RechargeAmount == 0) + .WhereIF(input.IsFree == false, x => x.RechargeAmount > 0) + .WhereIF(input.MinRechargeAmount.HasValue, x => x.RechargeAmount >= input.MinRechargeAmount!.Value) + .WhereIF(input.MaxRechargeAmount.HasValue, x => x.RechargeAmount <= input.MaxRechargeAmount!.Value) .OrderByDescending(x => x.CreationTime) - .ToListAsync(); + .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); + var output = entities.Adapt>(); - return output; + return new PagedResultDto(total, output); } ///