新增聊天室座驾系统

This commit is contained in:
pllx
2026-04-30 09:40:50 +08:00
parent 45ce8b2b2d
commit 3c95478097
32 changed files with 3982 additions and 53 deletions
+24 -1
View File
@@ -14,6 +14,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class ShopItem extends Model
{
public const TYPE_SIGN_REPAIR = 'sign_repair';
public const TYPE_RIDE = 'ride';
public const DECORATION_TYPES = ['msg_bubble', 'msg_name_color', 'msg_text_color', 'avatar_frame'];
protected $table = 'shop_items';
@@ -21,7 +24,7 @@ class ShopItem extends Model
protected $fillable = [
'name', 'slug', 'description', 'icon', 'price',
'type', 'duration_days', 'duration_minutes', 'sort_order', 'is_active',
'intimacy_bonus', 'charm_bonus',
'intimacy_bonus', 'charm_bonus', 'welcome_message',
];
protected $casts = [
@@ -60,6 +63,14 @@ class ShopItem extends Model
return in_array($this->type, self::DECORATION_TYPES, true);
}
/**
* 是否为聊天室座驾商品。
*/
public function isRide(): bool
{
return $this->type === self::TYPE_RIDE;
}
/**
* 是否为特效类商品(instant durationslug once_ week_ 开头)
*/
@@ -99,6 +110,18 @@ class ShopItem extends Model
return null;
}
/**
* 获取座驾全屏特效 key(去掉 ride_ 前缀)。
*/
public function rideKey(): ?string
{
if (str_starts_with($this->slug, 'ride_')) {
return substr($this->slug, 5);
}
return null;
}
/**
* 获取所有上架商品(按排序)
*/