tapi/app/service/ConfigService.php
2025-08-22 10:11:22 +08:00

31 lines
758 B
PHP

<?php
namespace app\service;
use app\model\SysConfig;
use think\facade\Config;
use think\Service;
class ConfigService extends Service
{
public function register()
{
Config::hook(function ($name, $default = null) {
if($name == "admin.jwt_key") {
return "123456a";
}
return $default;
// $value = self::getDynamicConfig($name);
// // 对配置参数和值进行处理后返回最终的配置值
// // ...
// return is_null($value) ? $default : $value;
});
}
public static function getDynamicConfig(string $key)
{
// return SysConfig::where('key', $key)
// ->cache(60)
// ->value('value');
}
}