增加 余额检查方法

This commit is contained in:
iVampireSP.com 2023-01-30 13:16:49 +08:00
parent d9b11fe169
commit 4ca16c809f
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -128,6 +128,11 @@ private function getBirthdayFromIdCard(): string
return $year . '-' . $month . '-' . $day; return $year . '-' . $month . '-' . $day;
} }
public function hasBalance(string $amount = "0.01"): bool
{
return bccomp($this->balance, $amount, 4) >= 0;
}
public function isAdult(): bool public function isAdult(): bool
{ {
// 如果 birthday_at 为空,那么就返回 false // 如果 birthday_at 为空,那么就返回 false