| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Module\Fund\Validators;
- use App\Module\Fund\Services\FundService;
- use UCore\Helper\Logger;
- use UCore\Validator;
- /**
- * 账户1检查
- *
- */
- class UserFund1CheckValidator extends Validator
- {
- // arg 0: user_idF, 1: field
- public function validate(mixed $value, array $data): bool
- {
- if($value < 0 ) {
- return false;
- }
- $user_idF = $this->args[0];
- $user_id = $data[$user_idF];
- $fund = new FundService($user_id, 1);
- $v2 = $value ;
- // dd($v2,$fund->balance());
- if ($fund->balance() < $v2) {
- Logger::error(" $user_id - fund-1 {$fund->balance()} < $value . ");
- return false;
- }
- $field = $this->args[1] ?? "";
- if ($field) {
- $this->validation->$field = $fund;
- }
- return true;
- }
- }
|