Feat: 商店功能完整实现(单次特效卡888/周卡8888/改名卡5000,含购买、周卡覆盖、改名黑名单)

This commit is contained in:
2026-02-27 15:57:12 +08:00
parent c52998671b
commit 7fb86bfe21
15 changed files with 999 additions and 4 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
/**
* 文件功能:用户名黑名单模型
* 用户改名后旧名称写入此表,保留期间其他人无法注册该名称
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UsernameBlacklist extends Model
{
protected $table = 'username_blacklist';
public $timestamps = false; // 只有 created_at 无 updated_at
protected $fillable = ['username', 'reserved_until', 'created_at'];
protected $casts = [
'reserved_until' => 'datetime',
'created_at' => 'datetime',
];
/**
* 判断给定名称是否在黑名单有效期内
*/
public static function isReserved(string $username): bool
{
return static::where('username', $username)
->where('reserved_until', '>', now())
->exists();
}
}