| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace UCore\Validator;
- use App\Module\Ulogic\Services\UserAddressService;
- use UCore\Validator;
- class IsUrausAddress extends Validator
- {
- /**
- * @param mixed $value
- * @param array $data
- * @return bool
- * 检测是否uraus地址
- */
- public function validate(mixed $value, array $data): bool
- {
- $sysStr = '0xuraus';
- $prefix = substr($data['to_address'], 0, 7); // 截取前 7 位
- if ($sysStr !== $prefix) {
- return false;
- }
- $addressData = UserAddressService::getDataByAddress($data['to_address']);
- if (!$addressData) {
- return false;
- }
- return true;
- }
- }
|