Add VIP presence themes and custom greetings
This commit is contained in:
@@ -20,6 +20,32 @@ class VipLevel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* 会员进退场支持的特效选项。
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
public const EFFECT_OPTIONS = [
|
||||
'none',
|
||||
'fireworks',
|
||||
'rain',
|
||||
'lightning',
|
||||
'snow',
|
||||
];
|
||||
|
||||
/**
|
||||
* 会员进退场支持的横幅风格选项。
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
public const BANNER_STYLE_OPTIONS = [
|
||||
'aurora',
|
||||
'storm',
|
||||
'royal',
|
||||
'cosmic',
|
||||
'farewell',
|
||||
];
|
||||
|
||||
/** @var string 表名 */
|
||||
protected $table = 'vip_levels';
|
||||
|
||||
@@ -32,6 +58,11 @@ class VipLevel extends Model
|
||||
'jjb_multiplier',
|
||||
'join_templates',
|
||||
'leave_templates',
|
||||
'join_effect',
|
||||
'leave_effect',
|
||||
'join_banner_style',
|
||||
'leave_banner_style',
|
||||
'allow_custom_messages',
|
||||
'sort_order',
|
||||
'price',
|
||||
'duration_days',
|
||||
@@ -44,6 +75,7 @@ class VipLevel extends Model
|
||||
'sort_order' => 'integer',
|
||||
'price' => 'integer',
|
||||
'duration_days' => 'integer',
|
||||
'allow_custom_messages' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -98,4 +130,44 @@ class VipLevel extends Model
|
||||
|
||||
return str_replace('{username}', $username, $template);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取规范化后的入场特效键名。
|
||||
*/
|
||||
public function joinEffectKey(): string
|
||||
{
|
||||
return in_array($this->join_effect, self::EFFECT_OPTIONS, true)
|
||||
? (string) $this->join_effect
|
||||
: 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取规范化后的离场特效键名。
|
||||
*/
|
||||
public function leaveEffectKey(): string
|
||||
{
|
||||
return in_array($this->leave_effect, self::EFFECT_OPTIONS, true)
|
||||
? (string) $this->leave_effect
|
||||
: 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取规范化后的入场横幅风格键名。
|
||||
*/
|
||||
public function joinBannerStyleKey(): string
|
||||
{
|
||||
return in_array($this->join_banner_style, self::BANNER_STYLE_OPTIONS, true)
|
||||
? (string) $this->join_banner_style
|
||||
: 'aurora';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取规范化后的离场横幅风格键名。
|
||||
*/
|
||||
public function leaveBannerStyleKey(): string
|
||||
{
|
||||
return in_array($this->leave_banner_style, self::BANNER_STYLE_OPTIONS, true)
|
||||
? (string) $this->leave_banner_style
|
||||
: 'farewell';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user