fix: 对话框 textContent 改为 innerText 支持换行;后端允许装扮批量购买
This commit is contained in:
@@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
class ShopItem extends Model
|
class ShopItem extends Model
|
||||||
{
|
{
|
||||||
public const TYPE_SIGN_REPAIR = 'sign_repair';
|
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';
|
protected $table = 'shop_items';
|
||||||
|
|
||||||
@@ -51,6 +52,14 @@ class ShopItem extends Model
|
|||||||
return $this->type === self::TYPE_SIGN_REPAIR;
|
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_ 开头)
|
* 是否为特效类商品(instant 或 duration,slug 以 once_ 或 week_ 开头)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class ShopService
|
|||||||
*/
|
*/
|
||||||
public function buyItem(User $user, ShopItem $item, int $quantity = 1): array
|
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' => '该商品暂不支持批量购买。'];
|
return ['ok' => false, 'message' => '该商品暂不支持批量购买。'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function openDialog({ message, title, color, type, defaultVal, confirmText, canc
|
|||||||
|
|
||||||
header.textContent = title;
|
header.textContent = title;
|
||||||
header.style.background = color;
|
header.style.background = color;
|
||||||
messageBox.textContent = message;
|
messageBox.innerText = message;
|
||||||
confirmButton.style.background = color;
|
confirmButton.style.background = color;
|
||||||
confirmButton.textContent = confirmText || "确定";
|
confirmButton.textContent = confirmText || "确定";
|
||||||
cancelButton.textContent = cancelText || "取消";
|
cancelButton.textContent = cancelText || "取消";
|
||||||
|
|||||||
Reference in New Issue
Block a user