| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Module\Fund\Validators;
- use App\Module\Fund\Services\FundService;
- use UCore\Validator;
- /**
- * 账户余额检查
- * 数额*1000的
- *
- */
- class UserFundCheck1000Validator extends Validator
- {
- public function validate(mixed $value, array $data): bool
- {
- if ($value < 0) {
- return false;
- }
- $value = $value * 1000;
- $user_id = $this->args[0];
- $fund_id = $this->args[1];
- $fund = new FundService($user_id, $fund_id);
- if ($fund->balance() < $value) {
- return false;
- }
- return true;
- }
- }
|