refactor(listing): 卖家发布定价改用整数分与基点
This commit is contained in:
@@ -42,6 +42,9 @@ func rowsToDTO(rows []listingRow) []ListingDTO {
|
||||
func normalizedListingPriceCent(req CreateRequest) int64 {
|
||||
if req.AssetSummary != nil {
|
||||
if breakdown, ok := req.AssetSummary["price_breakdown"].(map[string]any); ok {
|
||||
if buyerPriceCent := readSummaryInt64(breakdown["buyer_total_price_cent"]); buyerPriceCent > 0 {
|
||||
return buyerPriceCent
|
||||
}
|
||||
buyerPrice := readSummaryNumber(breakdown["buyer_total_price"])
|
||||
if buyerPrice > 0 {
|
||||
return yuanToCent(buyerPrice)
|
||||
@@ -144,11 +147,11 @@ func applySellerListingPrice(item *ListingDTO) {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
sellerPrice := readSummaryNumber(breakdown["seller_total_price"])
|
||||
if sellerPrice > 0 {
|
||||
item.PriceCent = int64(math.Round(sellerPrice * 100))
|
||||
sellerPriceCent := summaryMoneyCent(breakdown, "seller_total_price_cent", "seller_total_price")
|
||||
if sellerPriceCent > 0 {
|
||||
item.PriceCent = sellerPriceCent
|
||||
}
|
||||
sellerRatio := readSummaryNumber(breakdown["seller_ratio"])
|
||||
sellerRatio := summaryRatio(breakdown, "seller_ratio_bps", "seller_ratio")
|
||||
if sellerRatio > 0 {
|
||||
item.AssetSummary["publish_ratio"] = sellerRatio
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user