feat: 增强环境配置与开发服务,支持局域网访问及币种管理
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Support;
|
||||
|
||||
use App\Models\Player;
|
||||
use App\Models\Currency;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
@@ -52,6 +53,27 @@ final class CurrencyResolver
|
||||
return preg_match('/^[A-Z0-9]{1,16}$/', $code) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 币种是否已配置于主数据表。
|
||||
*/
|
||||
public static function exists(string $code): bool
|
||||
{
|
||||
return self::isValid($code)
|
||||
&& Currency::query()->where('code', strtoupper($code))->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 币种是否处于启用状态。
|
||||
*/
|
||||
public static function isEnabled(string $code): bool
|
||||
{
|
||||
return self::isValid($code)
|
||||
&& Currency::query()
|
||||
->where('code', strtoupper($code))
|
||||
->where('is_enabled', true)
|
||||
->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析并验证币种码,无效时返回 null。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user