feat: 会员概览补充等级编码与图标,收发件人国家返回二字码
All checks were successful
Build and Deploy / deploy (push) Successful in 59s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-10-07 17:34:32 +08:00
parent ae4e733a71
commit 9e5d6d20d5
5 changed files with 48 additions and 10 deletions

View File

@ -4,8 +4,12 @@ public class MemberOverviewOutput
{
public int? MemberLevelId { get; set; }
public string? MemberLevelCode { get; set; }
public string? MemberLevelName { get; set; }
public string? IconUrl { get; set; }
public string? PriceTierKey { get; set; }
public int TotalPoints { get; set; }

View File

@ -31,9 +31,9 @@ public class OrderReceiverOutput
public string? Email { get; set; }
/// <summary>
/// 国家/地区代码。
/// 国家/地区二字码。
/// </summary>
public int? CountryCode { get; set; }
public string? CountryCode { get; set; }
/// <summary>
/// 省份。

View File

@ -31,9 +31,9 @@ public class OrderSenderOutput
public string? Email { get; set; }
/// <summary>
/// 国家/地区代码。
/// 国家/地区二字码。
/// </summary>
public int? CountryCode { get; set; }
public string? CountryCode { get; set; }
/// <summary>
/// 省份。

View File

@ -57,7 +57,9 @@ public class MarketingPortalMemberService : ApplicationService
return new MemberOverviewOutput
{
MemberLevelId = currentLevel?.Id,
MemberLevelCode = currentLevel?.LevelCode,
MemberLevelName = currentLevel?.LevelName,
IconUrl = currentLevel?.IconUrl,
PriceTierKey = MarketingCustomerHelper.NormalizePriceTierKeyOrDefault(mainCustomer.PriceTierKey),
TotalPoints = account.TotalPoints,
RollingPoints = rollingPoints,

View File

@ -79,6 +79,20 @@ public partial class OrderService
: await CountryRepository.GetListAsync(x => countryCodes.Contains(x.CountryCode));
var countryMap = countries.ToDictionary(x => x.CountryCode, StringComparer.OrdinalIgnoreCase);
var addressCountryIds = senders
.Select(x => x.Country)
.Concat(recipients.Select(x => x.Country))
.Where(x => x.HasValue)
.Select(x => x!.Value)
.Distinct()
.ToArray();
var addressCountries = addressCountryIds.Length == 0
? []
: await CountryRepository.GetListAsync(x => addressCountryIds.Contains(x.Id));
var countryIdCodeMap = addressCountries.ToDictionary(
x => x.Id,
x => x.CountryCode ?? string.Empty);
var auditUserNameMap = await UserDisplayNameResolver.ResolveManyAsync(
orders.SelectMany(x => new[] { x.CreateUserId, x.UpdateUserId }));
@ -252,8 +266,8 @@ public partial class OrderService
CreateBy = OmsRbacUserDisplayNameResolver.FormatUserId(order.CreateUserId, auditUserNameMap),
UpdateTime = OmsDocHelper.NullIfDefault(order.UpdateTime),
UpdateBy = OmsRbacUserDisplayNameResolver.FormatUserId(order.UpdateUserId, auditUserNameMap),
Sender = MapSender(sender),
Receiver = MapReceiver(recipient),
Sender = MapSender(sender, countryIdCodeMap),
Receiver = MapReceiver(recipient, countryIdCodeMap),
Items = (items ?? []).Select(MapDeclaration).ToList(),
WeightList = (orderWeights ?? []).Select(MapWeight).ToList(),
FeeList = feeOutputs,
@ -705,7 +719,9 @@ public partial class OrderService
: null;
}
private static OrderSenderOutput? MapSender(OrderSender? sender)
private static OrderSenderOutput? MapSender(
OrderSender? sender,
IReadOnlyDictionary<int, string> countryIdCodeMap)
{
return sender == null
? null
@ -716,7 +732,7 @@ public partial class OrderService
Phone = sender.Phone,
TelePhone = sender.TelePhone,
Email = sender.Email,
CountryCode = sender.Country,
CountryCode = ResolveCountryCode(sender.Country, countryIdCodeMap),
Province = sender.Province,
City = sender.City,
ZipCode = sender.ZipCode,
@ -727,7 +743,9 @@ public partial class OrderService
};
}
private static OrderReceiverOutput? MapReceiver(OrderRecipient? recipient)
private static OrderReceiverOutput? MapReceiver(
OrderRecipient? recipient,
IReadOnlyDictionary<int, string> countryIdCodeMap)
{
return recipient == null
? null
@ -738,7 +756,7 @@ public partial class OrderService
Phone = recipient.Phone,
TelePhone = recipient.TelePhone,
Email = recipient.Email,
CountryCode = recipient.Country,
CountryCode = ResolveCountryCode(recipient.Country, countryIdCodeMap),
Province = recipient.Province,
City = recipient.City,
StreetNumber = recipient.StreetNumber,
@ -755,6 +773,20 @@ public partial class OrderService
};
}
private static string? ResolveCountryCode(
int? countryId,
IReadOnlyDictionary<int, string> countryIdCodeMap)
{
if (!countryId.HasValue)
{
return null;
}
return countryIdCodeMap.TryGetValue(countryId.Value, out var code) && !string.IsNullOrWhiteSpace(code)
? code
: null;
}
private OrderItemOutput MapDeclaration(OrderDeclaration x)
{
return new OrderItemOutput