diff --git a/backend/internal/modules/order/dto.go b/backend/internal/modules/order/dto.go index 4d3fb4c..cab9fa4 100644 --- a/backend/internal/modules/order/dto.go +++ b/backend/internal/modules/order/dto.go @@ -106,7 +106,7 @@ type UserOrderListItemDTO struct { CreatedAt time.Time `json:"created_at"` } -// AdminOrderListItemDTO 是后台订单表格的最小展示数据,敏感详情仅由详情接口按权限获取。 +// AdminOrderListItemDTO 是后台订单表格的最小展示数据;手机号按客服需要返回完整值,其余敏感详情仅由详情接口按权限获取。 type AdminOrderListItemDTO struct { ID uint64 `json:"id"` OrderNo string `json:"order_no"` diff --git a/backend/internal/modules/order/presenter.go b/backend/internal/modules/order/presenter.go index 7a9f958..6782ef2 100644 --- a/backend/internal/modules/order/presenter.go +++ b/backend/internal/modules/order/presenter.go @@ -205,8 +205,8 @@ func (row orderRow) toAdminListItem() AdminOrderListItemDTO { OrderNo: row.OrderNo, ListingID: row.ListingID, ListingNo: row.ListingNo, - OwnerPhone: maskPhone(row.OwnerPhone), - RenterPhone: maskPhone(row.RenterPhone), + OwnerPhone: row.OwnerPhone, + RenterPhone: row.RenterPhone, Title: row.Title, ServerRegion: row.ServerRegion, LoginPlatform: row.LoginPlatform, @@ -221,13 +221,6 @@ func (row orderRow) toAdminListItem() AdminOrderListItemDTO { } } -func maskPhone(phone string) string { - if len(phone) < 7 { - return "" - } - return phone[:3] + "****" + phone[len(phone)-4:] -} - func effectiveHandoffMode(order model.RentalOrder) string { if order.HandoffMode != "" { return order.HandoffMode diff --git a/backend/internal/modules/order/presenter_test.go b/backend/internal/modules/order/presenter_test.go index 4b4b558..a5a38de 100644 --- a/backend/internal/modules/order/presenter_test.go +++ b/backend/internal/modules/order/presenter_test.go @@ -72,7 +72,7 @@ func TestUserOrderListItemDoesNotSerializeDetailFields(t *testing.T) { } } -func TestAdminOrderListItemMasksPhonesAndOmitsSnapshot(t *testing.T) { +func TestAdminOrderListItemShowsPhonesAndOmitsSnapshot(t *testing.T) { row := orderRow{ RentalOrder: model.RentalOrder{ID: 1, OrderNo: "ORD-001", Status: orderStatusPendingPayment}, OwnerPhone: "13800001234", @@ -83,8 +83,11 @@ func TestAdminOrderListItemMasksPhonesAndOmitsSnapshot(t *testing.T) { t.Fatalf("Marshal() error = %v", err) } text := string(raw) - if strings.Contains(text, "13800001234") || strings.Contains(text, "13900005678") { - t.Fatalf("list response contains full phone number: %s", text) + // 后台订单列表需要展示完整手机号,方便客服定位用户。 + for _, phone := range []string{"13800001234", "13900005678"} { + if !strings.Contains(text, phone) { + t.Fatalf("list response should contain full phone %q: %s", phone, text) + } } if strings.Contains(text, "account_snapshot") { t.Fatalf("list response contains account snapshot: %s", text) diff --git a/frontend/src/features/orders/api/orders.ts b/frontend/src/features/orders/api/orders.ts index 38ef07e..8a1ade3 100644 --- a/frontend/src/features/orders/api/orders.ts +++ b/frontend/src/features/orders/api/orders.ts @@ -98,7 +98,7 @@ export interface UserOrderListItem { created_at: string } -// 后台订单列表使用脱敏后的表格数据,敏感字段仅在详情接口中按权限返回。 +// 后台订单列表返回客服需要的完整用户手机号,其余敏感字段仅在详情接口中按权限返回。 export interface AdminOrderListItem { id: number order_no: string