Покупка товара за нал и за безнал в случае нехватки нала. Closes #25. #40.

This commit is contained in:
lopar
2021-08-22 23:43:42 +03:00
parent 2b1287397d
commit 8f506dced2
3 changed files with 38 additions and 25 deletions
+7 -2
View File
@@ -237,7 +237,12 @@ class User
*/
public function setMoney(int $money): void
{
$this->money = $money;
$this->money = $money < 0 ? 0 : $money;
}
public function saveMoney()
{
self::$db->execute('update users set money = ? where id = ?', [$this->money, $this->id]);
}
@@ -338,7 +343,7 @@ class User
public function saveShadow()
{
self::$db->execute('UPDATE users SET shadow = ? WHERE id = ?', [$this->getShadow(), $this->getId()]);
self::$db->execute('UPDATE users SET shadow = ? WHERE id = ?', [$this->shadow, $this->id]);
}
/**