This commit is contained in:
zhx 2026-07-21 19:44:58 +08:00
parent 00db43b01b
commit 7f2aa1d450
4 changed files with 16 additions and 9 deletions

View File

@ -1,12 +1,14 @@
package resource
const (
TypeAvatarFrame = "avatar_frame"
TypeProfileCard = "profile_card"
TypeCoin = "coin"
TypeVehicle = "vehicle"
TypeChatBubble = "chat_bubble"
TypeBadge = "badge"
TypeAvatarFrame = "avatar_frame"
TypeProfileCard = "profile_card"
TypeCoin = "coin"
TypeVehicle = "vehicle"
TypeChatBubble = "chat_bubble"
TypeBadge = "badge"
// TypeFloatingScreen 是用户单选佩戴的飘窗皮肤;素材消费方读取装备快照,
// 商店和背包仍复用通用资源 SKU、entitlement 与 equipment 契约。
TypeFloatingScreen = "floating_screen"
TypeGift = "gift"
// TypeGiftTraySkin 复用 VIP 权益的稳定编码;目录素材与 gift 礼物本体分开,

View File

@ -106,7 +106,8 @@ type ResourceShopPurchaseReceipt struct {
func ResourceTypeSellableInShop(value string) bool {
switch NormalizeResourceType(value) {
case TypeAvatarFrame, TypeProfileCard, TypeVehicle, TypeChatBubble, TypeBadge, TypeMicSeatIcon, TypeMicSeatAnimation:
// 飘窗是有期限的用户装扮,购买后下发 entitlement不能按 gift 等消耗品处理。
case TypeAvatarFrame, TypeProfileCard, TypeVehicle, TypeChatBubble, TypeBadge, TypeFloatingScreen, TypeMicSeatIcon, TypeMicSeatAnimation:
return true
default:
return false

View File

@ -1021,7 +1021,9 @@ func (r *Repository) pruneExpiredUserResourceEquipment(ctx context.Context, user
func isEquipableResourceType(resourceType string) bool {
switch resourcedomain.NormalizeResourceType(resourceType) {
case resourcedomain.TypeAvatarFrame, resourcedomain.TypeProfileCard, resourcedomain.TypeVehicle, resourcedomain.TypeChatBubble, resourcedomain.TypeBadge, resourcedomain.TypeMicSeatAnimation, resourcedomain.TypeVIPTrialCard:
// 飘窗与头像框等用户装扮保持同一资源类型单选槽,切换时事务会替换同类型旧装备;
// badge 的多选和 VIP 体验卡的专用状态机仍由各自分支处理。
case resourcedomain.TypeAvatarFrame, resourcedomain.TypeProfileCard, resourcedomain.TypeVehicle, resourcedomain.TypeChatBubble, resourcedomain.TypeBadge, resourcedomain.TypeFloatingScreen, resourcedomain.TypeMicSeatAnimation, resourcedomain.TypeVIPTrialCard:
return true
default:
return false

View File

@ -743,7 +743,9 @@ func resourceShopPurchaseOrderSelectSQL() string {
}
func resourceShopItemsWhereSQL(query resourcedomain.ListResourceShopItemsQuery) (string, []any) {
where := `WHERE si.app_code = ? AND r.resource_type IN ('avatar_frame', 'profile_card', 'vehicle', 'chat_bubble', 'badge', 'mic_seat_icon', 'mic_seat_animation')`
// 固定类型白名单只增加一个等值分支,仍由 resource_shop_items 的 App/SKU 索引驱动并按
// (app_code, resource_id) 关联 resources不引入全表扫描或额外查询。
where := `WHERE si.app_code = ? AND r.resource_type IN ('avatar_frame', 'profile_card', 'vehicle', 'chat_bubble', 'badge', 'floating_screen', 'mic_seat_icon', 'mic_seat_animation')`
args := []any{query.AppCode}
if query.ActiveOnly {
nowMs := time.Now().UnixMilli()