调整
This commit is contained in:
@@ -16,41 +16,45 @@ public class TransactionRecordController(
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public async Task<PagedResponse<TransactionRecord>> GetListAsync(
|
||||
[FromQuery] DateTime? lastOccurredAt = null,
|
||||
[FromQuery] long? lastId = null,
|
||||
[FromQuery] int pageIndex = 1,
|
||||
[FromQuery] int pageSize = 20,
|
||||
[FromQuery] string? searchKeyword = null,
|
||||
[FromQuery] string? classify = null,
|
||||
[FromQuery] int? type = null,
|
||||
[FromQuery] int? year = null,
|
||||
[FromQuery] int? month = null
|
||||
[FromQuery] int? month = null,
|
||||
[FromQuery] bool sortByAmount = false
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
TransactionType? transactionType = type.HasValue ? (TransactionType)type.Value : null;
|
||||
var (list, lastTime, lastIdResult) = await transactionRepository.GetPagedListAsync(
|
||||
lastOccurredAt,
|
||||
lastId,
|
||||
20,
|
||||
var list = await transactionRepository.GetPagedListAsync(
|
||||
pageIndex,
|
||||
pageSize,
|
||||
searchKeyword,
|
||||
classify,
|
||||
transactionType,
|
||||
year,
|
||||
month,
|
||||
sortByAmount);
|
||||
var total = await transactionRepository.GetTotalCountAsync(
|
||||
searchKeyword,
|
||||
classify,
|
||||
transactionType,
|
||||
year,
|
||||
month);
|
||||
var total = await transactionRepository.GetTotalCountAsync();
|
||||
|
||||
return new PagedResponse<TransactionRecord>
|
||||
{
|
||||
Success = true,
|
||||
Data = list.ToArray(),
|
||||
Total = (int)total,
|
||||
LastId = lastIdResult,
|
||||
LastTime = lastTime
|
||||
Total = (int)total
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "获取交易记录列表失败,时间: {LastTime}, ID: {LastId}", lastOccurredAt, lastId);
|
||||
logger.LogError(ex, "获取交易记录列表失败,页码: {PageIndex}, 页大小: {PageSize}", pageIndex, pageSize);
|
||||
return PagedResponse<TransactionRecord>.Fail($"获取交易记录列表失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user