feat(listings): 详情页价格拆分收敛为一行展示
This commit is contained in:
@@ -78,12 +78,28 @@ func applyPublicListingURLs(item *ListingDTO) {
|
||||
rawScreenshotURLs := item.ScreenshotURLS
|
||||
item.ScreenshotURLS = publicScreenshotURLs(item.ID, item.ScreenshotURLS, item.Status, item.ReviewStatus)
|
||||
if item.AssetSummary != nil {
|
||||
applyPublicPriceBreakdown(item.AssetSummary)
|
||||
delete(item.AssetSummary, "import_meta")
|
||||
delete(item.AssetSummary, "price_breakdown")
|
||||
applyPublicScreenshotGroups(item.ID, item.AssetSummary, rawScreenshotURLs, item.ScreenshotURLS)
|
||||
}
|
||||
}
|
||||
|
||||
// applyPublicPriceBreakdown 把买家侧的纯币租金和额外物资摊平到资产摘要顶层。
|
||||
// 公共接口随后会删除完整的 price_breakdown,避免暴露卖家成本和平台加价。
|
||||
func applyPublicPriceBreakdown(summary map[string]any) {
|
||||
breakdown, ok := summary["price_breakdown"].(map[string]any)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if pureCoinCent := summaryMoneyCent(breakdown, "buyer_coin_base_price_cent", "buyer_coin_base_price"); pureCoinCent > 0 {
|
||||
summary["pure_coin_price_cent"] = pureCoinCent
|
||||
}
|
||||
if extraItemCent := summaryMoneyCent(breakdown, "consumable_price_cent", "consumable_price"); extraItemCent > 0 {
|
||||
summary["extra_item_price_cent"] = extraItemCent
|
||||
}
|
||||
}
|
||||
|
||||
func applyPublicScreenshotGroups(listingID uint64, assetSummary map[string]any, rawURLs []string, publicURLs []string) {
|
||||
rawGroups, ok := assetSummary["screenshot_groups"].(map[string]any)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user