Add poll system for Patrons Circle

This commit is contained in:
Alex Cabal 2022-06-29 16:51:45 -05:00
parent 3555d53615
commit 2ef5ce6551
44 changed files with 717 additions and 98 deletions

View file

@ -11,21 +11,13 @@ class Payment extends PropertiesBase{
public $Fee;
public $IsRecurring;
protected function GetUser(): ?User{
if($this->User === null && $this->UserId !== null){
$this->User = User::Get($this->UserId);
}
return $this->User;
}
public function Create(): void{
if($this->UserId === null){
// Check if we have to create a new user in the database
// If the User object isn't null, then check if we already have this user in our system
if($this->User !== null && $this->User->Email !== null){
$result = Db::Query('select * from Users where Email = ?', [$this->User->Email], 'User');
$result = Db::Query('SELECT * from Users where Email = ?', [$this->User->Email], 'User');
if(sizeof($result) == 0){
// User doesn't exist, create it now
@ -41,7 +33,7 @@ class Payment extends PropertiesBase{
}
try{
Db::Query('insert into Payments (UserId, Timestamp, ChannelId, TransactionId, Amount, Fee, IsRecurring) values(?, ?, ?, ?, ?, ?, ?);', [$this->UserId, $this->Timestamp, $this->ChannelId, $this->TransactionId, $this->Amount, $this->Fee, $this->IsRecurring]);
Db::Query('INSERT into Payments (UserId, Timestamp, ChannelId, TransactionId, Amount, Fee, IsRecurring) values(?, ?, ?, ?, ?, ?, ?);', [$this->UserId, $this->Timestamp, $this->ChannelId, $this->TransactionId, $this->Amount, $this->Fee, $this->IsRecurring]);
}
catch(PDOException $ex){
if($ex->errorInfo[1] == 1062){