From 68ed039aaa85460dee058896f10cb8dc1502610d Mon Sep 17 00:00:00 2001 From: lopar Date: Tue, 29 Sep 2020 11:59:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=B5=D0=BD=D0=B5=D0=B3=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D1=8C=20=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=87=D0=BD=D1=8B=D0=B5?= =?UTF-8?q?,=20=D1=87=D1=82=D0=BE=D0=B1=D1=8B=20=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=B1=D1=8B=D0=BB=D0=BE=20=D0=B2=D1=8B=D0=B7=D1=8B?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B8=D1=85=20=D0=B8=D0=B7=D0=B2?= =?UTF-8?q?=D0=BD=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/Bank.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/classes/Bank.php b/classes/Bank.php index 09aa7fd..5646155 100644 --- a/classes/Bank.php +++ b/classes/Bank.php @@ -105,9 +105,9 @@ class Bank } $this->money -= $amountWithComission; // Снимаем сумму с комиссией у отправителя - $this->setBankMoney($this->money, $this->user_id); + self::setBankMoney($this->money, $this->user_id); // Отдаём сумму на счёт получателю - $this->setBankMoney($amount, $receiver); + self::setBankMoney($amount, $receiver); $this->bankLogs($receiver, $amount, "sendMoney"); } @@ -131,10 +131,10 @@ class Bank // Забираем деньги из кошелька получателя //todo check it! $this->user->money -= $amount; - $this->setWalletMoney($this->user->money, $this->user_id); + self::setWalletMoney($this->user->money, $this->user_id); // Отдаём сумму на счёт получателю $this->money += $amount; - $this->setBankMoney($this->money, $this->user_id); + self::setBankMoney($this->money, $this->user_id); $this->bankLogs(0, $amount, "depositMoney"); } @@ -157,19 +157,19 @@ class Bank } // Снимаем сумму с комиссией у отправителя $this->money -= $amountWithComission; - $this->setBankMoney($this->money, $this->user_id); + self::setBankMoney($this->money, $this->user_id); // Отдаём сумму в кошелёк получателя //todo check it! $this->user->money += $amount; - $this->setWalletMoney($this->user->money, $this->user_id); + self::setWalletMoney($this->user->money, $this->user_id); $this->bankLogs(0, $amount, "withdrawMoney"); } - private function setBankMoney(int $amount, int $user_id): void + public static function setBankMoney(int $amount, int $user_id): void { db::c()->query('UPDATE bank SET money = ?i WHERE `id` = ?i', $amount, $user_id); } - private function setWalletMoney(int $amount, int $user_id): void + public static function setWalletMoney(int $amount, int $user_id): void { db::c()->query('UPDATE users SET money = ?i WHERE `id` = ?i', $amount, $user_id); }