From be245c14765c6a21fa6f70340088b5c42bf2ebf4 Mon Sep 17 00:00:00 2001 From: Zuncle <34310384@qq.com> Date: Wed, 25 Mar 2026 22:01:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(rewards):=20API=20=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=A5=96=E5=93=81=E5=8F=82=E8=80=83=E4=BB=B7=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=20price=5Fsnapshot=5Fcents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rewards 接口的 rewardItem 新增 price_snapshot_cents 字段, 将数据库中的商品价格快照(分)暴露给前端用于展示参考价。 --- internal/api/activity/rewards_app.go | 32 +++++++++++++++------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/internal/api/activity/rewards_app.go b/internal/api/activity/rewards_app.go index 0297a16..612d5d5 100755 --- a/internal/api/activity/rewards_app.go +++ b/internal/api/activity/rewards_app.go @@ -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) }