From 0a4d1219fa2a3d53fb33a97ca3ea3950ff1f583a Mon Sep 17 00:00:00 2001 From: adonis Date: Sun, 24 May 2026 13:56:33 +0330 Subject: [PATCH] added liman service --- .../Controllers/Admin/TahesabController.php | 10 ++++---- app/Http/Controllers/Auth/AuthController.php | 4 +-- app/Http/Controllers/Controller.php | 16 ------------ .../Controllers/Customer/WalletController.php | 4 +-- .../Single/SingleOrderController.php | 2 +- app/Services/ConfigService.php | 18 +++++++++++++ app/Services/LimanService.php | 25 +++++++++++++++++++ config/app.php | 2 +- routes/web.php | 4 +-- 9 files changed, 56 insertions(+), 29 deletions(-) create mode 100644 app/Services/ConfigService.php create mode 100644 app/Services/LimanService.php diff --git a/app/Http/Controllers/Admin/TahesabController.php b/app/Http/Controllers/Admin/TahesabController.php index 0798fa8..90e6714 100644 --- a/app/Http/Controllers/Admin/TahesabController.php +++ b/app/Http/Controllers/Admin/TahesabController.php @@ -194,9 +194,9 @@ class TahesabController extends Controller // if($data['bank'] == true) { // try { // $response = Http::withoutVerifying()->timeout(10)->withHeaders([ -// 'DBName' => $this->Config('tahesab_db'), +// 'DBName' => $this->ConfigService('tahesab_db'), // 'Content-Type' => 'application/json', -// 'Authorization' => "Bearer " . $this->Config('tahesab_token'), +// 'Authorization' => "Bearer " . $this->ConfigService('tahesab_token'), // ])->post((string)env('TAHESAB'), [ // "DoNewSanadVKHBank" => [ // 1,//Sabte_Kol_Or_Movaghat_1_0 @@ -209,7 +209,7 @@ class TahesabController extends Controller // (int)$data['direction'],//IsDayaftAzMoshtariOrPardakhtBeMoshtari_0_1 // (int)$data['value'],//Mablagh // $data['direction'] == 0 ? "شارژ حساب" : "برداشت از حساب",//Sharh -// (string)$this->Config('tahesab_bank_account'), //Name_Bank +// (string)$this->ConfigService('tahesab_bank_account'), //Name_Bank // "$tahesab->id",//Code_Rahgiri // -1,//Factor_Code // -1, @@ -234,9 +234,9 @@ class TahesabController extends Controller // }else{ // try { // $response = Http::withoutVerifying()->timeout(10)->withHeaders([ -// 'DBName' => $this->Config('tahesab_db'), +// 'DBName' => $this->ConfigService('tahesab_db'), // 'Content-Type' => 'application/json', -// 'Authorization' => "Bearer " . $this->Config('tahesab_token'), +// 'Authorization' => "Bearer " . $this->ConfigService('tahesab_token'), // ])->post((string)env('TAHESAB'), [ // "DoNewSanadTalabBedehi" => [ // 1,//Sabte_Kol_Or_Movaghat_1_0, diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index bb2de1f..24ebdbf 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -85,7 +85,7 @@ class AuthController extends Controller $user->token_sms = $rand; $user->save(); -// $this->SendMessage($mobile, 'رمز عبور یکبار مصرف شما جهت ورود به اپلیکشن ' . $this->Config('name_fa') . ' ' . $rand . ' می باشد' . PHP_EOL . "@$subDomain" . " #" . $r and,true ,"sms"); +// $this->SendMessage($mobile, 'رمز عبور یکبار مصرف شما جهت ورود به اپلیکشن ' . $this->ConfigService('name_fa') . ' ' . $rand . ' می باشد' . PHP_EOL . "@$subDomain" . " #" . $r and,true ,"sms"); $this->SendMessage($mobile, 'رمز عبور یکبار مصرف شما جهت ورود به اپلیکشن ' . $this->Config('name_fa') . ' ' . $rand . ' می باشد' . PHP_EOL . "@$subDomain" . " #" . $rand,true ,"sms"); return $user->id; @@ -148,7 +148,7 @@ class AuthController extends Controller if (isset($data['referral_to_id'])) { $referrer = Customer::where('referral_id', $data['referral_to_id'])->first(); if ($referrer) { -// $messageRef = "{$data['name']} با کد معرف شما ثبت نام کرد.\nدر صورت احراز او پاداش می‌گیرید.\n" . $this->Config('name_fa'); +// $messageRef = "{$data['name']} با کد معرف شما ثبت نام کرد.\nدر صورت احراز او پاداش می‌گیرید.\n" . $this->ConfigService('name_fa'); // $this->Send($referrer->mobile, $messageRef); $AdminMessage = "با معرفی {$referrer->name}، کاربر {$data['name']} در اپ {$this->Config('name_fa')} ثبت نام کرده و منتظر تایید شماست."; User::where('send_sms', 1)->get()->each(function ($admin) use ($AdminMessage, $data,) { diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 96b732e..f45a455 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -160,22 +160,6 @@ class Controller extends BaseController public static function Config($name) { return Setting::where('key',$name)->first()->value ?? false; - -// -// return $settings = collect(Setting::all()) -// ->mapWithKeys(function ($s) { -// return [$s['key'] => $s['value']]; -// })->firstWhere('key', $name)['value'] ?? false; -// return $settingValue = $settings->firstWhere('key', $name)['value'] ?? false; -// -// if (!$settingValue) { -// $subs = collect(Http::withToken('')->get('https://pm.gholaktala.ir/config/'.strtr($_SERVER['SERVER_NAME'], '.', '_'))->json()['subs']) -// ->firstWhere('name', $name)['value'] ?? false; -// -// return $subs; -// } -// -// return $settingValue; } public static function jibit($method, $p1 = null, $p2 = null, $p3 = null) diff --git a/app/Http/Controllers/Customer/WalletController.php b/app/Http/Controllers/Customer/WalletController.php index 23ed179..8e18b49 100644 --- a/app/Http/Controllers/Customer/WalletController.php +++ b/app/Http/Controllers/Customer/WalletController.php @@ -211,13 +211,13 @@ class WalletController extends Controller } /* try { $response = Http::withHeaders([ - 'Authorization' => 'Bearer ' . $this->Config('liman_token') + 'Authorization' => 'Bearer ' . $this->ConfigService('liman_token') ])->post('https://limangold.ir/kernel/customer/fin', [ 'receive_bank_shaba' => $bCart->shaba_number, 'receive_bank_card' => $bCart->cart_number, 'receive_name' => $customer->name, 'receive_account_number' => $bCart->account_number, - 'description' => $this->Config('name_fa') . ' | ' . $customer->mobile . ' | ' . $customer->name . ' | ' . $Withdraw->id, + 'description' => $this->ConfigService('name_fa') . ' | ' . $customer->mobile . ' | ' . $customer->name . ' | ' . $Withdraw->id, 'amount' => '1000' ])->json(); if (isset($response['id'])) { diff --git a/app/Http/Controllers/Single/SingleOrderController.php b/app/Http/Controllers/Single/SingleOrderController.php index 6f0290b..9595198 100644 --- a/app/Http/Controllers/Single/SingleOrderController.php +++ b/app/Http/Controllers/Single/SingleOrderController.php @@ -483,7 +483,7 @@ class SingleOrderController extends Controller ; if (isset($response['message']) && $response['message'] == 'no authorised') { $cnt = new Cnt(); - $response = Http::withToken($cnt->goldir_login())//$this->Config('liman_token')) + $response = Http::withToken($cnt->goldir_login())//$this->ConfigService('liman_token')) ->post($goldir_base_url."/server/customer/order", [ "mazaneh" => ((int)$mazaneh), 'amount' => $data['amount'], diff --git a/app/Services/ConfigService.php b/app/Services/ConfigService.php new file mode 100644 index 0000000..5bf3900 --- /dev/null +++ b/app/Services/ConfigService.php @@ -0,0 +1,18 @@ +first()->value ?? false; + } + public static function UpdateConfig($name,$value) + { + return Setting::where('key',$name)->update(['value'=>$value]); + } +} diff --git a/app/Services/LimanService.php b/app/Services/LimanService.php new file mode 100644 index 0000000..fcf44b4 --- /dev/null +++ b/app/Services/LimanService.php @@ -0,0 +1,25 @@ +Config('liman_mobile'); + $password = app(ConfigService::class)->Config('liman_password'); + + $liman = Http::post('http://212.23.201.173/server/auth/login', [ + 'mobile' => $mobile,//شماره اکانت اپلیکیشن هنزا تو لیمان ایدی 1377 + 'password' => $password, + 'provider' => 'customer', + 'type_app' => 'client', + ])->json(); + + app(ConfigService::class)->UpdateConfig('liman_token', $liman['token']); + return $liman['access_token']; + } +} diff --git a/config/app.php b/config/app.php index 0f49904..1affae8 100644 --- a/config/app.php +++ b/config/app.php @@ -199,7 +199,7 @@ return [ 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, 'Bus' => Illuminate\Support\Facades\Bus::class, 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, + 'ConfigService' => Illuminate\Support\Facades\Config::class, 'Cookie' => Illuminate\Support\Facades\Cookie::class, 'Crypt' => Illuminate\Support\Facades\Crypt::class, 'Date' => Illuminate\Support\Facades\Date::class, diff --git a/routes/web.php b/routes/web.php index 7e6d915..613a3f3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -282,13 +282,13 @@ Route::get('/getJibitCounter', function (Request $request) { //Route::get('testliman', function () { // $payload = [ // 'amount' => "0.02", -// 'description' =>$this->Config('name_fa')." - "."سس ", +// 'description' =>$this->ConfigService('name_fa')." - "."سس ", // 'ref_id' => 000, // 'direction' => 1, // 'product_id' => 2 // ]; // -// return $response = Http::withToken($this->Config('liman_token')) +// return $response = Http::withToken($this->ConfigService('liman_token')) // ->post("https://limangold.ir/kernel/customer/order",$payload)->json(); // //});