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