初始化仓库及v1.0.0提交

This commit is contained in:
2026-05-05 03:21:58 +08:00
commit 813bb02672
67 changed files with 5263 additions and 0 deletions

27
app/Models/Config.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use App\Config\Database;
class Config
{
public static function getByKey(string $key): ?array
{
$db = Database::getInstance();
$stmt = $db->prepare('SELECT * FROM config WHERE config_key = :config_key');
$stmt->execute(['config_key' => $key]);
$result = $stmt->fetch();
return $result ?: null;
}
public static function setByKey(string $key, string $value): bool
{
$db = Database::getInstance();
$stmt = $db->prepare('INSERT INTO config (config_key, config_value) VALUES (:config_key, :config_value) ON DUPLICATE KEY UPDATE config_value = VALUES(config_value)');
return $stmt->execute([
'config_key' => $key,
'config_value' => $value,
]);
}
}