Files
boursecu_server/app/Services/LimanService.php
T

33 lines
827 B
PHP
Raw Normal View History

2026-05-24 13:56:33 +03:30
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
class LimanService
{
2026-05-24 19:22:09 +03:30
public function liman_login()
{
$config = app(ConfigService::class);
2026-05-24 13:56:33 +03:30
2026-05-24 19:22:09 +03:30
$mobile = $config->Config('liman_mobile');
$password = $config->Config('liman_password');
$liman = Http::timeout(10)->post('http://212.23.201.173/server/auth/login', [
'mobile' => $mobile,
2026-05-24 13:56:33 +03:30
'password' => $password,
'provider' => 'customer',
'type_app' => 'client',
])->json();
2026-05-24 19:22:09 +03:30
$token = $liman['access_token'] ?? $liman['token'] ?? null;
if (!$token) {
throw new \Exception('Liman login failed: ' . json_encode($liman, JSON_UNESCAPED_UNICODE));
}
$config->UpdateConfig('liman_token', $token);
return $token;
2026-05-24 13:56:33 +03:30
}
2026-05-24 19:22:09 +03:30
}