diff --git a/AssetManager.API/Controllers/PortfolioController.cs b/AssetManager.API/Controllers/PortfolioController.cs index 5126e6b..5cb7c31 100755 --- a/AssetManager.API/Controllers/PortfolioController.cs +++ b/AssetManager.API/Controllers/PortfolioController.cs @@ -98,6 +98,50 @@ public class PortfolioController : ControllerBase }); } + /// + /// 获取交易记录(通过 query parameter) + /// + [HttpGet("transactions")] + public async Task>> GetTransactionsByQuery( + [FromQuery] string portfolioId, + [FromQuery] int limit = 20, + [FromQuery] int offset = 0) + { + var userId = GetCurrentUserId(); + + try + { + var request = new GetTransactionsRequest + { + PortfolioId = portfolioId, + Limit = limit, + Offset = offset + }; + + var transactions = await _portfolioFacade.GetTransactionsAsync(portfolioId, request, userId); + + return Ok(new ApiResponse + { + code = Models.StatusCodes.Success, + data = new GetTransactionsResponse + { + Items = transactions, + Total = transactions.Count + }, + message = "success" + }); + } + catch (UnauthorizedAccessException) + { + return NotFound(new ApiResponse + { + code = Models.StatusCodes.NotFound, + data = null, + message = "组合不存在" + }); + } + } + /// /// 获取投资组合详情 ///