From cdec289740c86269c3bfed066f136e536eb52b46 Mon Sep 17 00:00:00 2001 From: pllx Date: Tue, 28 Apr 2026 13:16:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=B9=E8=AF=9D=E6=A1=86=20textConten?= =?UTF-8?q?t=20=E6=94=B9=E4=B8=BA=20innerText=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=8D=A2=E8=A1=8C=EF=BC=9B=E5=90=8E=E7=AB=AF=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E8=A3=85=E6=89=AE=E6=89=B9=E9=87=8F=E8=B4=AD=E4=B9=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/ShopItem.php | 9 +++++++++ app/Services/ShopService.php | 2 +- resources/js/chat-room/dialog.js | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Models/ShopItem.php b/app/Models/ShopItem.php index 8fb67a5..f119a49 100644 --- a/app/Models/ShopItem.php +++ b/app/Models/ShopItem.php @@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; class ShopItem extends Model { public const TYPE_SIGN_REPAIR = 'sign_repair'; + public const DECORATION_TYPES = ['msg_bubble', 'msg_name_color', 'msg_text_color', 'avatar_frame']; protected $table = 'shop_items'; @@ -51,6 +52,14 @@ class ShopItem extends Model return $this->type === self::TYPE_SIGN_REPAIR; } + /** + * 是否为个人装扮(气泡、颜色、头像框等)。 + */ + public function isDecoration(): bool + { + return in_array($this->type, self::DECORATION_TYPES, true); + } + /** * 是否为特效类商品(instant 或 duration,slug 以 once_ 或 week_ 开头) */ diff --git a/app/Services/ShopService.php b/app/Services/ShopService.php index 167a0aa..64efc4e 100644 --- a/app/Services/ShopService.php +++ b/app/Services/ShopService.php @@ -30,7 +30,7 @@ class ShopService */ public function buyItem(User $user, ShopItem $item, int $quantity = 1): array { - if ($quantity !== 1 && $item->type !== ShopItem::TYPE_SIGN_REPAIR) { + if ($quantity !== 1 && $item->type !== ShopItem::TYPE_SIGN_REPAIR && !$item->isDecoration()) { return ['ok' => false, 'message' => '该商品暂不支持批量购买。']; } diff --git a/resources/js/chat-room/dialog.js b/resources/js/chat-room/dialog.js index deea175..63b4284 100644 --- a/resources/js/chat-room/dialog.js +++ b/resources/js/chat-room/dialog.js @@ -44,7 +44,7 @@ function openDialog({ message, title, color, type, defaultVal, confirmText, canc header.textContent = title; header.style.background = color; - messageBox.textContent = message; + messageBox.innerText = message; confirmButton.style.background = color; confirmButton.textContent = confirmText || "确定"; cancelButton.textContent = cancelText || "取消";