value] * @return array 设置结果 [key => success] */ public static function setBatch(array $configs): array { return MexConfigLogic::setBatch($configs); } /** * 重置配置为默认值 * * @param string $key 配置键名 * @return bool */ public static function reset(string $key): bool { return MexConfigLogic::reset($key); } /** * 检查配置是否存在 * * @param string $key 配置键名 * @return bool */ public static function exists(string $key): bool { return MexConfigLogic::exists($key); } /** * 检查配置是否启用 * * @param string $key 配置键名 * @return bool */ public static function isEnabled(string $key): bool { return MexConfigLogic::isEnabled($key); } /** * 启用/禁用配置 * * @param string $key 配置键名 * @param bool $enabled 是否启用 * @return bool */ public static function setEnabled(string $key, bool $enabled): bool { return MexConfigLogic::setEnabled($key, $enabled); } /** * 清除配置缓存 * * @param string|null $key 配置键名,为空时清除所有缓存 */ public static function clearCache(?string $key = null): void { MexConfigLogic::clearCache($key); } /** * 验证配置值 * * @param string $key 配置键名 * @param mixed $value 配置值 * @return array */ public static function validateValue(string $key, $value): array { return MexConfigLogic::validateValue($key, $value); } // === 业务相关的配置快捷方法 === /** * 检查系统是否启用 * * @return bool */ public static function isSystemEnabled(): bool { return self::getBool('system.enabled', true); } /** * 检查是否为维护模式 * * @return bool */ public static function isMaintenanceMode(): bool { return self::getBool('system.maintenance_mode', false); } /** * 检查是否允许买入 * * @return bool */ public static function isBuyAllowed(): bool { return self::getBool('trading.allow_buy', true); } /** * 检查是否允许卖出 * * @return bool */ public static function isSellAllowed(): bool { return self::getBool('trading.allow_sell', true); } /** * 检查撮合功能是否启用 * * @return bool */ public static function isMatchingEnabled(): bool { return self::getBool('matching.enabled', true); } /** * 获取撮合间隔时间 * * @return int */ public static function getMatchingInterval(): int { return self::getInt('matching.match_interval', 30); } /** * 获取最大订单金额 * * @return float */ public static function getMaxOrderAmount(): float { return self::getFloat('trading.max_order_amount', 100000.0); } /** * 获取最小订单金额 * * @return float */ public static function getMinOrderAmount(): float { return self::getFloat('trading.min_order_amount', 0.01); } /** * 获取最大订单数量 * * @return int */ public static function getMaxOrderQuantity(): int { return self::getInt('trading.max_order_quantity', 10000); } /** * 获取最小订单数量 * * @return int */ public static function getMinOrderQuantity(): int { return self::getInt('trading.min_order_quantity', 1); } /** * 检查是否启用频率限制 * * @return bool */ public static function isRateLimitEnabled(): bool { return self::getBool('security.rate_limit_enabled', true); } /** * 获取每分钟最大订单数 * * @return int */ public static function getMaxOrdersPerMinute(): int { return self::getInt('security.max_orders_per_minute', 10); } /** * 获取每小时最大订单数 * * @return int */ public static function getMaxOrdersPerHour(): int { return self::getInt('security.max_orders_per_hour', 100); } /** * 检查是否启用价格保护 * * @return bool */ public static function isPriceProtectionEnabled(): bool { return self::getBool('market.price_protection', true); } /** * 检查是否启用缓存 * * @return bool */ public static function isCacheEnabled(): bool { return self::getBool('performance.cache_enabled', true); } /** * 获取缓存过期时间 * * @return int */ public static function getCacheTtl(): int { return self::getInt('performance.cache_ttl', 3600); } /** * 检查是否启用自动生成每日价格趋势 * * @return bool */ public static function isAutoGenerateDailyTrendsEnabled(): bool { return self::getBool('pricing.auto_generate_daily_trends', true); } /** * 获取所有配置(用于管理界面) * * @return \Illuminate\Support\Collection */ public static function getAllConfigs() { return MexConfigLogic::getAllConfigs(); } }