fix(listing): 修复编号序列冲突并按角色隔离价格字段
This commit is contained in:
@@ -57,6 +57,7 @@ func normalizedListingPriceCent(req CreateRequest) int64 {
|
||||
func publicListings(items []ListingDTO) []ListingDTO {
|
||||
for index := range items {
|
||||
applyPublicListingURLs(&items[index])
|
||||
applyPublicListingPrice(&items[index])
|
||||
}
|
||||
return items
|
||||
}
|
||||
@@ -156,12 +157,47 @@ func applySellerListingPrice(item *ListingDTO) {
|
||||
item.AssetSummary["publish_ratio"] = sellerRatio
|
||||
}
|
||||
delete(breakdown, "buyer_coin_base_price")
|
||||
delete(breakdown, "buyer_coin_base_price_cent")
|
||||
delete(breakdown, "buyer_total_price")
|
||||
delete(breakdown, "buyer_total_price_cent")
|
||||
delete(breakdown, "buyer_ratio")
|
||||
delete(breakdown, "buyer_ratio_bps")
|
||||
delete(breakdown, "platform_markup_amount")
|
||||
delete(breakdown, "platform_markup_amount_cent")
|
||||
delete(breakdown, "platform_rule_type")
|
||||
}
|
||||
|
||||
// applyPublicListingPrice 只保留买家侧价格字段,隐藏卖家成本与平台加价。
|
||||
func applyPublicListingPrice(item *ListingDTO) {
|
||||
if item == nil || item.AssetSummary == nil {
|
||||
return
|
||||
}
|
||||
breakdown, ok := item.AssetSummary["price_breakdown"].(map[string]any)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
for _, key := range []string{
|
||||
"seller_reference_ratio",
|
||||
"seller_reference_ratio_bps",
|
||||
"seller_ratio",
|
||||
"seller_ratio_bps",
|
||||
"seller_coin_base_price",
|
||||
"seller_coin_base_price_cent",
|
||||
"seller_total_price",
|
||||
"seller_total_price_cent",
|
||||
"platform_markup_amount",
|
||||
"platform_markup_amount_cent",
|
||||
"platform_rule_type",
|
||||
"admin_adjust_reason",
|
||||
"admin_adjusted_at",
|
||||
"admin_adjusted_by",
|
||||
"site_receive_ratio_delta",
|
||||
"site_receive_cost_delta",
|
||||
} {
|
||||
delete(breakdown, key)
|
||||
}
|
||||
}
|
||||
|
||||
func (row listingRow) toDTO() ListingDTO {
|
||||
assetSummary := decodeAssetSummary(row.AssetSummary)
|
||||
screenshotURLS := cleanScreenshotURLs(decodeScreenshots(row.ScreenshotURLS))
|
||||
|
||||
Reference in New Issue
Block a user