feat(rewards): API 返回奖品参考价字段 price_snapshot_cents

rewards 接口的 rewardItem 新增 price_snapshot_cents 字段,
将数据库中的商品价格快照(分)暴露给前端用于展示参考价。
This commit is contained in:
Zuncle 2026-03-25 22:01:28 +08:00
parent 89be01f8e3
commit be245c1476

View File

@ -12,19 +12,20 @@ import (
)
type rewardItem struct {
ID int64 `json:"id"`
ProductID int64 `json:"product_id"`
Name string `json:"name"`
Weight int32 `json:"weight"`
Quantity int64 `json:"quantity"`
OriginalQty int64 `json:"original_qty"`
Level int32 `json:"level"`
PrizeLevel int32 `json:"prize_level"` // 兼容部分前端逻辑
Sort int32 `json:"sort"`
IsBoss int32 `json:"is_boss"`
ProductImage string `json:"product_image"`
MinScore int64 `json:"min_score"`
DropQuantity int32 `json:"drop_quantity"`
ID int64 `json:"id"`
ProductID int64 `json:"product_id"`
Name string `json:"name"`
Weight int32 `json:"weight"`
Quantity int64 `json:"quantity"`
OriginalQty int64 `json:"original_qty"`
Level int32 `json:"level"`
PrizeLevel int32 `json:"prize_level"` // 兼容部分前端逻辑
Sort int32 `json:"sort"`
IsBoss int32 `json:"is_boss"`
ProductImage string `json:"product_image"`
MinScore int64 `json:"min_score"`
DropQuantity int32 `json:"drop_quantity"`
PriceSnapshotCents int64 `json:"price_snapshot_cents"` // 参考价(分)
}
type listRewardsResponse struct {
@ -131,8 +132,9 @@ func (h *handler) ListIssueRewards() core.HandlerFunc {
IsBoss: v.IsBoss,
ProductImage: imageMap[v.ProductID],
MinScore: v.MinScore,
DropQuantity: v.DropQuantity,
}
DropQuantity: v.DropQuantity,
PriceSnapshotCents: v.PriceSnapshotCents,
}
}
ctx.Payload(res)
}