功能:商店完善戒指板块
迁移:
- 2026_03_01_153959:shop_items 增加 intimacy_bonus/charm_bonus 字段
Seeder(RingItemsSeeder):
- 银质戒指 500金 亲密+10 魅力+30
- 黄金戒指 2000金 亲密+30 魅力+80
- 红宝石戒指 8000金 亲密+80 魅力+200
- 钻石戒指 30000金 亲密+200 魅力+500
- 传说神戒 100000金 亲密+500 魅力+1000
ShopService:
- buyItem() 分支加 ring 类型
- buyRing():扣金币 + 写入 active UserPurchase(背包持有)
ShopController::items():
- 返回 intimacy_bonus/charm_bonus
- 统计 ring_counts(各戒指持有数量)
shop-panel.blade.php:
- 新增「💍 求婚戒指」分组(排在最后)
- 图标右上角红色数字徽章(持有时)
- 卡片下方显示亲密度/魅力加成
- 购买按钮与现有逻辑复用
This commit is contained in:
@@ -318,6 +318,8 @@
|
||||
badge.style.display = 'inline-block';
|
||||
}
|
||||
|
||||
const ringCounts = data.ring_counts || {};
|
||||
|
||||
const groups = [{
|
||||
label: '⚡ 单次特效卡',
|
||||
desc: '立即播放一次,仅自己可见',
|
||||
@@ -333,6 +335,11 @@
|
||||
desc: '',
|
||||
type: 'one_time'
|
||||
},
|
||||
{
|
||||
label: '💍 求婚戒指',
|
||||
desc: '购买后存入背包,求婚时消耗(若被拒绝则遗失)',
|
||||
type: 'ring'
|
||||
},
|
||||
];
|
||||
|
||||
const itemsEl = document.getElementById('shop-items-list');
|
||||
@@ -361,6 +368,8 @@
|
||||
items.forEach(item => {
|
||||
const isRename = item.slug === 'rename_card';
|
||||
const canUseRename = isRename && data.has_rename_card;
|
||||
const isRing = item.type === 'ring';
|
||||
const ownedQty = isRing ? (ringCounts[item.id] || 0) : 0;
|
||||
|
||||
const card = document.createElement('div');
|
||||
card.className = 'shop-card';
|
||||
@@ -369,11 +378,22 @@
|
||||
const row = document.createElement('div');
|
||||
row.className = 'shop-card-row';
|
||||
|
||||
// 图标
|
||||
// 图标区(戒指加持有数徽标)
|
||||
const iconWrap = document.createElement('span');
|
||||
iconWrap.style.cssText =
|
||||
'position:relative; flex-shrink:0; width:28px; text-align:center;';
|
||||
const icon = document.createElement('span');
|
||||
icon.className = 'shop-card-icon';
|
||||
icon.textContent = item.icon;
|
||||
row.appendChild(icon);
|
||||
iconWrap.appendChild(icon);
|
||||
if (isRing && ownedQty > 0) {
|
||||
const badge = document.createElement('span');
|
||||
badge.style.cssText =
|
||||
'position:absolute; top:-4px; right:-4px; background:#f43f5e; color:#fff; font-size:8px; font-weight:800; min-width:14px; height:14px; border-radius:7px; text-align:center; line-height:14px; padding:0 2px;';
|
||||
badge.textContent = ownedQty;
|
||||
iconWrap.appendChild(badge);
|
||||
}
|
||||
row.appendChild(iconWrap);
|
||||
|
||||
// 名称
|
||||
const name = document.createElement('span');
|
||||
@@ -404,6 +424,25 @@
|
||||
card.appendChild(desc);
|
||||
}
|
||||
|
||||
// 戒指:加成信息行
|
||||
if (isRing && (item.intimacy_bonus > 0 || item.charm_bonus > 0)) {
|
||||
const bonus = document.createElement('div');
|
||||
bonus.style.cssText =
|
||||
'font-size:9px; color:#f43f5e; margin-top:3px; display:flex; gap:8px;';
|
||||
if (item.intimacy_bonus > 0) {
|
||||
const b1 = document.createElement('span');
|
||||
b1.textContent = `💞 亲密 +${item.intimacy_bonus}`;
|
||||
bonus.appendChild(b1);
|
||||
}
|
||||
if (item.charm_bonus > 0) {
|
||||
const b2 = document.createElement('span');
|
||||
b2.style.color = '#a855f7';
|
||||
b2.textContent = `✨ 魅力 +${item.charm_bonus}`;
|
||||
bonus.appendChild(b2);
|
||||
}
|
||||
card.appendChild(bonus);
|
||||
}
|
||||
|
||||
section.appendChild(card);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user