config service for show liman price

This commit is contained in:
2026-05-24 19:22:09 +03:30
parent d684290848
commit 81d4aa8926
3 changed files with 30 additions and 22 deletions
+18 -10
View File
@@ -3,23 +3,31 @@
namespace App\Services;
use Illuminate\Support\Facades\Http;
use League\Flysystem\Config;
use app\services\ConfigService;
class LimanService
{
public function liman_login(){
$mobile = app(ConfigService::class)->Config('liman_mobile');
$password = app(ConfigService::class)->Config('liman_password');
public function liman_login()
{
$config = app(ConfigService::class);
$liman = Http::post('http://212.23.201.173/server/auth/login', [
'mobile' => $mobile,//شماره اکانت اپلیکیشن هنزا تو لیمان ایدی 1377
$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,
'password' => $password,
'provider' => 'customer',
'type_app' => 'client',
])->json();
app(ConfigService::class)->UpdateConfig('liman_token', $liman['token']);
return $liman['access_token'];
$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;
}
}
}