asdsad
This commit is contained in:
@@ -1669,7 +1669,11 @@ class ApiKernel
|
||||
$customerId = (int)($user['customer_id'] ?? 0);
|
||||
if ($customerId <= 0) $this->fail('Customer context missing', null, 500);
|
||||
$table = $this->senderTable();
|
||||
$stmt = $this->pdo->prepare("SELECT * FROM `$table` WHERE `customer_id` = :cid ORDER BY `label` ASC");
|
||||
try {
|
||||
$stmt = $this->pdo->prepare("SELECT * FROM `$table` WHERE `customer_id` = :cid ORDER BY `label` ASC");
|
||||
} catch (Throwable $e) {
|
||||
$this->fail('Sender-Tabelle existiert nicht', $e->getMessage(), 500);
|
||||
}
|
||||
$stmt->execute([':cid' => $customerId]);
|
||||
$items = [];
|
||||
while ($row = $stmt->fetch()) {
|
||||
@@ -1995,10 +1999,9 @@ class ApiKernel
|
||||
private function ensureCustomerSettingsTableExists(): void
|
||||
{
|
||||
$table = $this->customerSettingsTable();
|
||||
if ($this->tableExists($table)) {
|
||||
return;
|
||||
}
|
||||
$sql = <<<SQL
|
||||
if ($this->tableExists($table)) return;
|
||||
try {
|
||||
$sql = <<<SQL
|
||||
CREATE TABLE IF NOT EXISTS `$table` (
|
||||
`customer_id` int(10) unsigned NOT NULL,
|
||||
`bridge_url` varchar(500) DEFAULT NULL,
|
||||
@@ -2011,8 +2014,11 @@ CREATE TABLE IF NOT EXISTS `$table` (
|
||||
PRIMARY KEY (`customer_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
|
||||
SQL;
|
||||
$this->pdo->exec($sql);
|
||||
$this->tableExistsCache[$table] = true;
|
||||
$this->pdo->exec($sql);
|
||||
$this->tableExistsCache[$table] = true;
|
||||
} catch (Throwable $e) {
|
||||
$this->fail('Customer-Settings Tabelle fehlt und konnte nicht erstellt werden', $e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
private function generateToken(int $length = 48): string
|
||||
|
||||
Reference in New Issue
Block a user