修复用户本位币为空字符串时的默认值逻辑,兼容null和空两种情况

This commit is contained in:
claw_bot 2026-03-10 12:48:28 +00:00
parent dcb80d9b85
commit fb5faeee81

View File

@ -198,7 +198,7 @@ public class PortfolioService : IPortfolioService
throw new Exception("User not found"); throw new Exception("User not found");
} }
string targetCurrency = user.DefaultCurrency ?? "CNY"; string targetCurrency = !string.IsNullOrEmpty(user.DefaultCurrency) ? user.DefaultCurrency : "CNY";
_logger.LogInformation("用户 {UserId} 默认本位币: {Currency}", userId, targetCurrency); _logger.LogInformation("用户 {UserId} 默认本位币: {Currency}", userId, targetCurrency);
decimal totalValueInTargetCurrency = 0; decimal totalValueInTargetCurrency = 0;
decimal totalCostInTargetCurrency = 0; decimal totalCostInTargetCurrency = 0;