mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-03-13 05:51:10 +00:00
add page methods, add user.approved field
This commit is contained in:
parent
3dd619baa7
commit
e560c38c1f
@ -77,6 +77,29 @@ class AppModelDatabase
|
||||
return $this->_debug;
|
||||
}
|
||||
|
||||
// Page
|
||||
public function addPage(int $timeAdded) : int
|
||||
{
|
||||
$this->_debug->query->insert->total++;
|
||||
|
||||
$query = $this->_db->prepare('INSERT INTO `page` SET `timeAdded` = ?');
|
||||
|
||||
$query->execute([$timeAdded]);
|
||||
|
||||
return $this->_db->lastInsertId();
|
||||
}
|
||||
|
||||
public function getPage(int $pageId)
|
||||
{
|
||||
$this->_debug->query->select->total++;
|
||||
|
||||
$query = $this->_db->prepare('SELECT * FROM `page` WHERE `pageId` = ?');
|
||||
|
||||
$query->execute([$pageId]);
|
||||
|
||||
return $query->fetch();
|
||||
}
|
||||
|
||||
// Scheme
|
||||
public function addScheme(string $value) : int {
|
||||
|
||||
@ -491,13 +514,13 @@ class AppModelDatabase
|
||||
}
|
||||
|
||||
// User
|
||||
public function addUser(string $address, bool $approved, $timeAdded) : int {
|
||||
public function addUser(string $address, bool $status, bool $approved, $timeAdded) : int {
|
||||
|
||||
$this->_debug->query->insert->total++;
|
||||
|
||||
$query = $this->_db->prepare('INSERT INTO `user` SET `address` = ?, `approved` = ?, `timeAdded` = ?');
|
||||
$query = $this->_db->prepare('INSERT INTO `user` SET `address` = ?, `status` = ?, `approved` = ?, `timeAdded` = ?');
|
||||
|
||||
$query->execute([$address, (int) $approved, $timeAdded]);
|
||||
$query->execute([$address, (int) $status, (int) $approved, $timeAdded]);
|
||||
|
||||
return $this->_db->lastInsertId();
|
||||
}
|
||||
@ -562,14 +585,14 @@ class AppModelDatabase
|
||||
return $query->fetch();
|
||||
}
|
||||
|
||||
public function initUserId(string $address, bool $approved, int $timeAdded) : int {
|
||||
public function initUserId(string $address, bool $status, bool $approved, int $timeAdded) : int {
|
||||
|
||||
if ($result = $this->findUserByAddress($address)) {
|
||||
|
||||
return $result->userId;
|
||||
}
|
||||
|
||||
return $this->addUser($address, $approved, $timeAdded);
|
||||
return $this->addUser($address, $status, $approved, $timeAdded);
|
||||
}
|
||||
|
||||
public function updateUserApproved(int $userId, mixed $approved, int $timeUpdated) : int {
|
||||
|
Loading…
x
Reference in New Issue
Block a user