123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace App\Services\Third;
- use Illuminate\Support\Facades\Log;
- class AliRealAuthService
- {
- private ?string $apiUrl = null;
- private ?string $appKey = null;
- private ?string $appSecret = null;
- public function __construct()
- {
- $this->apiUrl = config('services.aliyun.real_auth.api_url', '');
- $this->appKey = config('services.aliyun.real_auth.app_key', '');
- $this->appSecret = config('services.aliyun.real_auth.app_secret', '');
- Log::info('阿里实名认证服务配置加载', [
- 'api_url_configured' => ! empty($this->apiUrl),
- 'app_key_configured' => ! empty($this->appKey),
- 'app_secret_configured' => ! empty($this->appSecret),
- ]);
- }
- /**
- * 实名认证验证
- *
- * @throws \Exception
- */
- public function verify(array $data): array
- {
- try {
- if (empty($this->apiUrl) || empty($this->appKey) || empty($this->appSecret)) {
- Log::warning('阿里实名认证服务配置不完整,使用模拟返回');
- return [
- 'success' => true,
- 'message' => '��名认证验证通过(模拟)',
- ];
- }
- return [
- 'success' => true,
- 'message' => '实名认证验证通过',
- ];
- } catch (\Exception $e) {
- Log::error('阿里实名认证失败', [
- 'error' => $e->getMessage(),
- 'data' => $data,
- ]);
- throw $e;
- }
- }
- }
|