CheckHash.php 655 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Module\Transaction\Validators;
  3. use App\Module\Transaction\Enums\RECHARGE_STATUS;
  4. use App\Module\Transaction\Enums\STATUS;
  5. use App\Module\Transaction\Models\Transaction;
  6. use App\Module\Transaction\Models\TransactionRecharge;
  7. use UCore\Validator;
  8. class CheckHash extends Validator
  9. {
  10. /**
  11. * @param mixed $value
  12. * @param array $data
  13. * @return bool
  14. * 添加hash校验
  15. */
  16. public function validate(mixed $value, array $data): bool
  17. {
  18. $rechargeData = TransactionRecharge::checkHash($data['hash']);
  19. if ($rechargeData) {
  20. return false;
  21. }
  22. return true;
  23. }
  24. }