From 4ca16c809f83695c0414bc4b3afba238a57713c6 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Mon, 30 Jan 2023 13:16:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E4=BD=99=E9=A2=9D?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Models/User.php b/app/Models/User.php index 0a29a22..7576c7e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -128,6 +128,11 @@ private function getBirthdayFromIdCard(): string return $year . '-' . $month . '-' . $day; } + public function hasBalance(string $amount = "0.01"): bool + { + return bccomp($this->balance, $amount, 4) >= 0; + } + public function isAdult(): bool { // 如果 birthday_at 为空,那么就返回 false